Converting To and Using js-joda

node v10.15.1
version: 1.0.0
endpointsharetweet
The native JavaScript Date library is very, well, _lightweight_, so libraries such as js-joda can help. Once a native date is converted to a js-joda one, with a little (unnecessary?!) help:
const { LocalDate, TemporalAdjusters } = require("js-joda") const nativeDate = new Date() // https://stackoverflow.com/a/32274316/85662 const localDate = LocalDate.parse(new Date().toISOString().split("T")[0])
... you can start to take advantage of its powerful features:
localDate.with(TemporalAdjusters.firstDayOfMonth())
Loading…

no comments

    sign in to comment