Gathering detailed insights and metrics for dayjs-plugin-utc
Gathering detailed insights and metrics for dayjs-plugin-utc
Gathering detailed insights and metrics for dayjs-plugin-utc
Gathering detailed insights and metrics for dayjs-plugin-utc
a plugin for dayjs gives dayjs the ability to operate UTC timezone
npm install dayjs-plugin-utc
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
20 Stars
17 Commits
8 Forks
1 Watching
19 Branches
2 Contributors
Updated on 20 Apr 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-7.5%
56,558
Compared to previous day
Last week
-0.8%
299,442
Compared to previous week
Last month
17.4%
1,237,868
Compared to previous month
Last year
5%
12,261,641
Compared to previous year
English | 简体中文
this is a plugin for dayjs, that gives dayjs the ability to operate UTC timezone
1npm i dayjs-plugin-utc --save
1import dayjsPluginUTC from 'dayjs-plugin-utc' 2 3dayjs.extend(dayjsPluginUTC)
1<!-- Latest compiled and minified JavaScript --> 2<script src="https://unpkg.com/dayjs"></script> 3<script src="https://unpkg.com/dayjs-plugin-utc"></script> 4<script> 5 dayjs.extend(dayjsPluginUTC.default) 6</script>
⚠️ NOTICE⚠️
when NOT add this plugin
dayjs()
will return an instance that timezone based of you local1dayjs('2018-05-18T03:04:05+06:00').format() // 2018-05-18T05:04:05+08:00
after load this plugin the timezone of instance return by
dayjs()
will rely on what you passed1dayjs.extend(dayjsPluginUTC) 2dayjs('2018-05-18T03:04:05+06:00').format() // 2018-05-18T03:04:05+06:00
if you always want an local timezone instance would be create or you already use dayjs in you project
you can load this plugin with option
parseToLocal: true
1dayjs.extend(dayjsPluginUTC, { parseToLocal: true }) 2dayjs('2018-05-18T03:04:05+06:00').format() // 2018-05-18T05:04:05+08:00
get an instance in UTC
1 dayjs.utc() 2 dayjs.utc('2018-05-18T03:04:05+06:00') 3 /* (string | number | Date | Dayjs) support like dayjs() */
with dayjs().utcOffset()
you can get the UTC offset in minutes.
Note:
dayjs().utcOffset()
returns the real offset from UTC, not the reverse offset (as returned by Date.prototype.getTimezoneOffset).
also you can check the timezone of an instance is local or UTC by dayjs().isLocal()
and dayjs().isUTC()
1 dayjs().utcOffset() // (-480, -120, 0, 120, 480, etc.) 2 dayjs().isLocal() // true 3 dayjs().isUTC() // false
using dayjs().utc()
and dayjs().local()
you can set the timezone to UTC or you local timezone , and dayjs().utcOffset(Number)
you can specify the timezone you want
1 let day = dayjs('2018-05-18T03:04:05+06:00') 2 3 day.utc().format() // 2018-05-17T21:04:05+00:00 4 5 day.local().format() // 2018-05-18T05:04:05+08:00 6 7 day.utcOffset(240).format() // 2018-05-18T01:04:05+04:00
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
Found 3/11 approved changesets -- score normalized to 2
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
license file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
66 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