Gathering detailed insights and metrics for date-format
Gathering detailed insights and metrics for date-format
Gathering detailed insights and metrics for date-format
Gathering detailed insights and metrics for date-format
node.js formatting of Date objects as strings. Probably exactly the same as some other library out there.
npm install date-format
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
59 Stars
214 Commits
17 Forks
4 Watching
2 Branches
4 Contributors
Updated on 03 Jul 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-2%
1,126,006
Compared to previous day
Last week
4.1%
6,022,589
Compared to previous week
Last month
12.7%
24,559,770
Compared to previous month
Last year
16.5%
240,213,382
Compared to previous year
5
node.js formatting of Date objects as strings. Probably exactly the same as some other library out there.
1npm install date-format
1var format = require('date-format'); 2format.asString(); // defaults to ISO8601 format and current date 3format.asString(new Date()); // defaults to ISO8601 format 4format.asString('hh:mm:ss.SSS', new Date()); // just the time 5format.asString(format.ISO8601_WITH_TZ_OFFSET_FORMAT, new Date()); // in ISO8601 with timezone
or
1var format = require('date-format'); 2format(); // defaults to ISO8601 format and current date 3format(new Date()); // defaults to ISO8601 format 4format('hh:mm:ss.SSS', new Date()); // just the time 5format(format.ISO8601_WITH_TZ_OFFSET_FORMAT, new Date()); // in ISO8601 with timezone
output:
12017-03-14T14:10:20.391 22017-03-14T14:10:20.391 314:10:20.391 42017-03-14T14:10:20.391+11:00
Format string can be anything, but the following letters will be replaced (and leading zeroes added if necessary):
date.getDate()
date.getMonth() + 1
date.getFullYear().toString().substring(2, 4)
date.getFullYear()
date.getHours()
date.getMinutes()
date.getSeconds()
date.getMilliseconds()
Built-in formats:
format.ISO8601_FORMAT
- 2017-03-14T14:10:20.391
(local time used)format.ISO8601_WITH_TZ_OFFSET_FORMAT
- 2017-03-14T14:10:20.391+11:00
(local + TZ used)format.DATETIME_FORMAT
- 14 03 2017 14:10:20.391
(local time used)format.ABSOLUTETIME_FORMAT
- 14:10:20.391
(local time used)The date format library has limited ability to parse strings into dates. It can convert strings created using date format patterns (as above), but if you're looking for anything more sophisticated than that you should probably look for a better library (momentjs does pretty much everything).
1var format = require('date-format'); 2// pass in the format of the string as first argument 3format.parse(format.ISO8601_FORMAT, '2017-03-14T14:10:20.391'); 4format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T14:10:20.391+1100'); 5format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T14:10:20.391+11:00'); 6format.parse(format.ISO8601_WITH_TZ_OFFSET_FORMAT, '2017-03-14T03:10:20.391Z'); 7// returns Date
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
SAST tool detected but not run on all commits
Details
Reason
5 existing vulnerabilities detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 1
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/13 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
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
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