Gathering detailed insights and metrics for @topgames/chronoshift
Gathering detailed insights and metrics for @topgames/chronoshift
Gathering detailed insights and metrics for @topgames/chronoshift
Gathering detailed insights and metrics for @topgames/chronoshift
npm install @topgames/chronoshift
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
136 Commits
1 Watching
11 Branches
Updated on 21 Dec 2020
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
0%
2
Compared to previous day
Last week
2,200%
23
Compared to previous week
Last month
-62.1%
36
Compared to previous month
Last year
55.7%
425
Compared to previous year
Chronoshift is a library to manipulate time with timezones
In node simply run: npm install chronoshift
In the browser you should use the browserified package/chronoshift.js
Chronoshift can be used in two ways:
Use chronoshift[period][fn](date, timezone, moveAmount)
where
period
is one of ['year', 'month', 'day', 'hour', 'minute', 'second', 'millisecond']
fn
is one of ['floor, ceil, move']
1var tz = Timezone.fromJS("America/Los_Angeles"); 2 3var hourStart = chronoshift.hour.floor(new Date("2012-11-04T00:30:00-07:00"), tz)); 4 5hourStart.getTime() === new Date("2012-11-04T00:00:00-07:00").getTime()
Construct a new duration with a ISO Duration string. Then you can call floor
, ceil
and move
on it.
Note that floor
and ceil
only work for 'simple' durations like "P1x" and "PT1x".
1var Duration = chronoshift.Duration; 2var tz = Timezone.fromJS("America/Los_Angeles"); 3 4p1w = Duration.formJS('P1W'); 5 6var weekStart; 7 8weekStart = p1w.floor(new Date("2013-09-29T01:02:03.456-07:00"), tz) 9weekStart.getTime() === new Date("2013-09-29T00:00:00.000-07:00").getTime() 10 11weekStart = p1w.floor(new Date("2013-10-03T01:02:03.456-07:00"), tz) 12weekStart.getTime() === new Date("2013-09-29T00:00:00.000-07:00").getTime()
A duration can also be constructed from two dates and a timezone:
1new Duration( 2 new Date("2012-10-29T00:00:00-07:00") 3 new Date("2012-11-05T00:00:00-08:00") 4 tz 5).toString() // => 'P7D' 6 7new Duration( 8 new Date("2012-01-01T00:00:00-08:00") 9 new Date("2013-03-04T04:05:06-08:00") 10 tz 11).toString() // => 'P1Y2M3DT4H5M6S'
Useful!
Clone the repository :
$ git clone https://github.com/implyio/chronoshift.git
Install the dependencies :
$ npm install
Watch :
$ npm run watch
Please file bugs and feature requests by opening and issue on GitHub and direct all questions to our user groups.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
58 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More