@frontierjs/datetime-kit

0.0.7 • Public • Published

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)
}

Dependencies (1)

Dev Dependencies (0)

    Package Sidebar

    Install

    npm i @frontierjs/datetime-kit

    Weekly Downloads

    3

    Version

    0.0.7

    License

    ISC

    Unpacked Size

    20 kB

    Total Files

    16

    Last publish

    Collaborators

    • jdkdev