github github
Yeah,
the world's pretty big.
but this library is very small ✨
{{timezone}}:
{{s.format('month')+' '+s.format('date-ordinal')}}
{{s.time()}}
6am
noon
6pm
10pm
jan
feb
mar
apr
may
jun
jul
aug
sept
oct
nov
dec
 
{{c.title}} +
spacetime date-utility
💥 - local model of remote TZ
💥 - DST, leap-year, hemisphere!
💥 - moment-like💙 API
💥 - quarter, season, and week-orientation
40 kb
that's more like it
npm install spacetime
or
<script src='https://unpkg.com/spacetime'></script>
👹 spacetime does some ugly things.
it can sometimes get confused. 🌌
but by making realistic compromises, spacetime considerably under-weighs most date libraries.
It lets you have a mostly-great time, without thinking about awful things.
now go crazy:
how the?
it is currently {{epoch}} everywhere (even in Australia).
[Fake-Paris]
time
= Epoch time
({{epoch}})
your computer's offset
({{offset}} mins)
+ current offset
Europe/Paris
(with DST)
that's not too bad.

but hold up -

to change the date, you have to shift to your computer's offset, make the calendar-based change, then shift it back to Paris time, in some kind of distopian web programming:
this is error-prone!

one challenge is that different DST rules may apply on your computer, compared to Paris-time.
- you may miss a DST-shift while pretending to be in Paris, but lying about it.
another possibility is making a very specific time locally, that doesn't exist in Paris-time.
spacetime 🎉 (mostly) addresses these problems in post-processing the date after every transformation, to ensure the funny-business is a minimum.

if it's 9:37pm, and you move forward 6 months, it should still be 9:37pm.
- even the day of the month should remain stable too, when possible

There is admittedly, some guesswork involved.
but what a pleasure, to let this little library do that for you 🌈

not for every use-case, fine for most. -
API:
{{doc.title}}(): {{doc.doc}}
returns: {{doc.out}}
main:
{{k}}()
getters/setters
{{k}}()
utils:
{{k}}()

Apache-2.0 - by SmallWins