drd-helpers

Helper functions for the various drd projects

Usage no npm install needed!

<script type="module">
  import drdHelpers from 'https://cdn.skypack.dev/drd-helpers';
</script>

README

drd-helpers

NPM JavaScript Style Guide

Install

yarn add drd-helpers

Usage

import { generateSnappingPoints, start, end } from "drd-helpers";

const doctorSchedules = [
  {
    dt_start: moment()
      .set({
        hour: 10,
        minute: 0,
        second: 0,
        millisecond: 0,
      })
      .toDate(),
    rrule_id:
      "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,SA;BYHOUR=10;BYMINUTE=0;BYSECOND=0",
    duration: "04:30:00",
  },
  {
    dt_start: moment()
      .set({
        hour: 17,
        minute: 0,
        second: 0,
        millisecond: 0,
      })
      .toDate(),
    rrule_id:
      "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH;BYHOUR=17;BYMINUTE=0;BYSECOND=0",
    duration: "02:00:00",
  },
];

const appoitments = [
  {
    dt_start: moment()
      .set({
        hour: 10,
        minute: 30,
        second: 0,
        millisecond: 0,
      })
      .toDate(),
    rrule_id:
      "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH,SA;BYHOUR=10;BYMINUTE=30;BYSECOND=0",
    duration: "00:30:00",
  },
  {
    dt_start: moment()
      .set({
        hour: 13,
        minute: 0,
        second: 0,
        millisecond: 0,
      })
      .toDate(),
    rrule_id:
      "RRULE:FREQ=WEEKLY;BYDAY=MO,TU,WE,TH;BYHOUR=13;BYMINUTE=00;BYSECOND=0",
    duration: "00:30:00",
  },
];

const items = generateSnappingPoints(
  start,
  end,
  doctorSchedules,
  appoitments,
  30
);

Source repo

https://gitlab.com/drd1/drd-v2/drd-helpers

Deploy

Increment the library version in package.json

{
  ...
  version: "1.x",
  ...
}

Bundle the code

yarn run build

Commit and push your changes to the repo.

  git add .
  git commit -m 'Some commit'
  git push

Run npm publish

Note: you have to log in with the tech_drd account in order to publish the package. To log in use the npm login commands

License

MIT © drd