shitty-date
v1.1.0
Published
manage dates by timezones
Downloads
7
Readme
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)