2.0.3 • Published 4 years ago

@attestis/clear-delay v2.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

@attestis/clear-delay

This package aims to calculate clear delay between 2 dates. See french definition of clear delay here.

Getting started

yarn add @attestis/clear-delay

then

import { AttClearDelay } from "@attestis/clear-delay";
const atClrDelay = new AttClearDelay()
const lastMoment = atClrDelay.setDate('2020-02-29').addClearDelay(2, 'M');
console.log("lastMoment", lastMoment)
/* will display
    lastMoment moment("2020-05-04T23:59:59.000")
*/
console.log(atClrDelay.outputs)
/* will display
[ { date: 'samedi 29 février 2020',
        text: 'date d\'application (dies ad quo)' },
      { date: 'dimanche 01  mars 2020 00:00', text: 'jour 1' },
      { date: 'lundi 02  mars 2020 00:00', text: 'jour 2' },
      { date: 'mardi 03  mars 2020 00:00', text: 'jour 3' },
        ...
      { date: 'jeudi 30  avril 2020 00:00', text: 'jour 61' },
      { date: 'vendredi 01  mai 2020 00:00', text: 'jour 62' },
      { date: 'samedi 02  mai 2020 00:00', text: 'est un samedi' },
      { date: 'dimanche 03  mai 2020 00:00', text: 'est un dimanche' },
      { date: 'lundi 04  mai 2020 23:59',
        text: 'date de fin au plus tard (dies ad quem)' } ]
*/

//use setDate to clear outputs and dates
const newLastMoment = atClearDelay.setDate('2020-03-5').addClearDelay(1,'d');
// ...
2.0.3

4 years ago

2.0.2

4 years ago

2.0.1

4 years ago

2.0.0

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago