shitty-date

1.1.0 • Public • Published

Locale dates

const DATE = require(`shitty-date`)
 
//Initialize new date (now) with specified locale
const date = DATE('America/Toronto')
 
//Get datetime
let locale = date.get()
 
//Get datetime with another specified locale
let utc = date.get('UTC')

Initialize with specified timestamp

const timestamp = 1588551082176
const date = DATE('Europe/Lisbon', timestamp)

Options

  • timezone : Timezone string
  • timestamp : Initialization time (Defaut is now)

Adjusting the time parameters

const date = DATE('Asia/Hong_Kong')
date.set({ h:10, m:20 })

Options

  • yy : Year
  • mm : Month
  • dd : Day
  • h : Hours
  • m : Minutes
  • s : Seconds
  • ms : Milliseconds

Recall time with locale overrides

const date = DATE('Europe/London')
console.log( date.get() )
console.log( date.get('UTC') )
console.log( date.get('Americas/New_York') )

Options

  • timezone : Locale to override (Default is the initialized locale)

Readme

Keywords

none

Package Sidebar

Install

npm i shitty-date

Weekly Downloads

1

Version

1.1.0

License

ISC

Unpacked Size

6.3 kB

Total Files

4

Last publish

Collaborators

  • r3volved