Would you like to clone this notebook?

When you clone a notebook you are able to make changes without affecting the original notebook.

Cancel

RunKit + npm: dayjs

node v10.24.1
version: 1.0.0
endpointsharetweet
var dayjs = require("dayjs"); var utc = require("dayjs/plugin/utc"); var timezone = require("dayjs/plugin/timezone"); dayjs.extend(utc); dayjs.extend(timezone); var date = "2022-03-22T19:27:08"; var madrid = "Europe/Madrid"; var london = "Europe/London"; console.log("Madrid, +2 weeks:", dayjs.tz(date, madrid).add(2, "weeks").format()); console.log("Madrid, +2 weeks (utc+2). Expected: 2022-04-05T17:27:08Z:", dayjs.tz(date, madrid).add(2, "weeks").utc().format()); console.log("London, +2 weeks:", dayjs.tz(date, london).add(2, "weeks").format()); console.log("London, +2 weeks (utc+1). Expected: 2022-04-05T18:27:08Z:", dayjs.tz(date, london).add(2, "weeks").utc().format());
Created from: https://npm.runkit.com/dayjs
Loading…

no comments

    sign in to comment