Period Edge
This package aims to help calculate the start & end timestamp of custom period, like 4 weeks. This is a sub-project of relative-time-expression.
Install
npm i period-edge
Usage
; // Suppose we are in Shanghai(+8h), and it's 2019-06-14 18:00:00.;;
Api
;;
Period
Period constructed with integer and unit string, like 2w. Supported units: s, m, h, d, w.
Regular expression:
//
Special logic about week period
- Week period use monday as first day according to ISO 8601, if you want to use sunday, you could subtract one day to result.
- This lib will use
1970-01-05T00:00:00
in your timezone as first week to calculate multiple weeks period.