@frontierjs/datetime-kit
v0.0.7
Published
Wrangle in those dates to get your Frontier project done on time
Downloads
382
Readme
Date Basics:
const d = new Date();
// Standard
console.log('ISOString', d.toISOString())
console.log('JSON', d.toJSON())
console.log('UTCString', d.toUTCString())
//
console.log('String', d.toString())
console.log('DateString', d.toDateString())
console.log('TimeString', d.toTimeString())
//
console.log('LocaleString', d.toLocaleString())
console.log('LocaleDateString', d.toLocaleDateString())
console.log('LocalTimeString', d.toLocaleTimeString())
datetime-kit
import {format, relativeTo, relativeToNow} from '@frontierjs/datetime-kit'
Date.prototype.format = function (formatPattern, options) {
return format(this, formatPattern, options)
}
Date.prototype.relativeTo = function (dateTo, formatPattern, options) {
return relativeTo(this, dateTo, formatPattern)
}
Date.prototype.relativeToNow = function (formatPattern, options) {
return relativeToNow(this, new Date(), formatPattern, options)
}