Clone and edit this document
Runkit
Runkit
home page
user forum
new notebook
clone notebook
download notebook
support & documentation
log in
sign up
new notebook
help & feedback
clone this notebook
download this notebook
Sign In
Sign Up
RunKit + npm: dayjs
node v10.24.1
version:
master
endpoint
share
tweet
var dayjs = require("dayjs@1.10.4") var utc = require('dayjs/plugin/utc'); var timezone = require('dayjs/plugin/timezone'); dayjs.extend(utc); dayjs.extend(timezone); var moment = require('moment-timezone'); const dates = ['2019-10-30', '2019-11-01', '2020-10-30', '2020-11-01'] dates.forEach(date => { const dayjsOffset = dayjs(date).tz('America/Sao_Paulo').format('Z') const momentOffset = moment(date).tz('America/Sao_Paulo').format('Z') console.log(`Offset for ${date} | dayjs: ${dayjsOffset} | moment: ${momentOffset} | equal ${dayjsOffset == momentOffset}`) })
Created from: https://npm.runkit.com/dayjs
Loading…
no comments
sign in
to comment