Lightweight Way to Handle Timezones in JS – Spacetime

A lightweight way to manipulate, traverse, compare, and format dates and times across planet Earth

Spacetime does some ugly things. it can sometimes get confused. but by making realistic compromises space-time considerably under-weighs most date libraries.
It lets you have a mostly-great time, without thinking about awful things.

  1. Get/set dates and times in remote timezone
  2. Global support for Daylight Savings Timeleap years + seconds, and hemispheres
  3. Orient by quarter, season, month, and week
  4. Remote date comparison
  5. Written in ES2015 JS, published as ES5, tested for Node and the browser
  6. Weighs in at just 35KB (12KB compressed)
  7. Well tested, Apache 2.0 licensed
  8. Made by your friendly friends at Begin


<script src=""></script>
  var d = spacetime('March 1 2012', 'America/New_York')
  //set the time
  d = d.time('4:20pm')

  d = d.goto('America/Los_Angeles')

npm install spacetime

const spacetime = require('spacetime')
let d ='Europe/Paris')

Or with Typescript

import spacetime from 'spacetime'
let d =
//'Apr 1st, 4:32pm'

make sure to add this to your tsconfig.json:

  "compilerOptions": {
    "esModuleInterop": true


[fix] for formatting when the output is 0 ????
[fix] for leap-day in .date() method
update deps
add github release/publish script
add support for changing start/end of the week
allow more flexible .i18n() inputs
faster diff for large-number of months
more support for esoteric iso formats
add format('iso-month')
change fallback behaviour for set failure edge-cases
avoid setting dates/months/hours past maximums and minimums
.hour(24) now changes date to tomorrow
faster diffs for large (decade-long) ranges
[big] fix awkward diff/since issues ('dec 25->jan 5' should be 0 years)
support typescript types by Jacob Craig
use given timezone when given a spacetime object as an input
adds .every(unit, to) method
set UTC as default fallback timezone
support more time input formats
fixes offset input issue #103
added more iana timezones
fixed zero-padding in iso offsets
support half hour offsets in iso formats
Pattern Lock jQuery Plugin for Android