News for hackers. Stuff that matters.
Re:Luxon – A library for working with dates and times in JS by ianstormtaylor on Saturday November 18, 2017 @03:11PM (#15730422)
How does this compare in file size to Moment? That's the only real issue I have with it.
Re:Luxon – A library for working with dates and times in JS by dawkins on Saturday November 18, 2017 @05:26PM (#15731011)
If you only want timezone conversions I removed everything else from Moment. It's less than 2KB uncompressed: https://github.com/scorredoira/timezone.js
Re:Luxon – A library for working with dates and times in JS by pitaj on Saturday November 18, 2017 @07:38PM (#15731560)
I my experience the actual timezone information is the heaviest portion of the payload. I can't wait until all browsers have support for `Intl`
Re:Luxon – A library for working with dates and times in JS by seanp2k2 on Sunday November 19, 2017 @12:52AM (#15732483)
That any computers talk to each other about time in any other terms than epoch is insane to me. From there, converting it to local time zone is pretty easy, but it should be a presentation-layer ONLY thing. If you’ve ever worked with or implemented a system where this wouldn’t work, I’m interested in hearing about why.
Re:Luxon – A library for working with dates and times in JS by CodesInChaos on Sunday November 19, 2017 @04:55AM (#15733129)
If you schedule a meeting in the future you typically agree on a local time in a specific timezone. So the (local time, timezone) tuple is the authoritative value you want to store (you can cache the utc time if you want).

Just storing the utc time and timezone is problematic, since the conversion function between utc and local can change via tz database updates, sometimes with little notice (Israel is notorious for sometimes only deciding on the DST switching date shortly before it happens).

In principle you could store (utc-time, offset used to convert from local, timezone), but I find that rather unintuitive and error prone, since it doesn't cleanly separate authoritative from cached values.

Re:Luxon – A library for working with dates and times in JS by icambron on Sunday November 19, 2017 @07:59AM (#15733711)
Ideally, yes. There are a lot of times you need it though:

1. Recurring meeting events have to take place in a certain zone so that the right epoch time can be calculated for the recurrences across DSTs

2. Even single meetings need them (see other post in this thread)

3. You may need other zone's local times. Imagine you're scheduling shifts for people to work. If you're in a different zone than work is scheduled in, the presentation later needs to know that zone to compute the right epoch times.

Re:Luxon – A library for working with dates and times in JS by dmitriid on Sunday November 19, 2017 @08:41AM (#15733831)
> That any computers talk to each other about time in any other terms than epoch is insane to me.

Year 2038 problem: https://en.wikipedia.org/wiki/Year_2038_problem

Re:Luxon – A library for working with dates and times in JS by pitaj on Sunday November 19, 2017 @02:22AM (#15732727)
Ah, sorry. I was speaking more in terms of internationalization than actually converting between time zones. All you need is a database, but that database can be hard to maintain and can be very large.
Re:Luxon – A library for working with dates and times in JS by gjjrfcbugxbhf on Sunday November 19, 2017 @02:44AM (#15732783)
Why epoch over UTC?
Re:Luxon – A library for working with dates and times in JS by pygy_ on Saturday November 18, 2017 @04:27PM (#15730798)
After minification with Uglify:

27.3 KB compressed with `gzip -9`, 26.4KB with `zopfli -i1000` and 24.0KB with `brotli -q 11`.

(kilo, not kibi)

Re:Luxon – A library for working with dates and times in JS by icambron on Saturday November 18, 2017 @09:31PM (#15731922)
I'd love to make it smaller. Several of the builds contain polyfills for newish JS features not supported in IE. I'd like to strip that out and shave off a few k.
Re:Luxon – A library for working with dates and times in JS by collectively on Saturday November 18, 2017 @05:13PM (#15730982)
TIL they just completely redefined a kilobyte a while ago.
Re:Luxon – A library for working with dates and times in JS by orf on Saturday November 18, 2017 @09:59PM (#15732018)
Can you elaborate?
Re:Luxon – A library for working with dates and times in JS by collectively on Saturday November 18, 2017 @11:21PM (#15732226)
At some point, a kilobyte was 1024 bytes. Now, a kilobyte is 1000 bytes, and 1024 bytes is a kibibyte.

I mean, it does make sense. But it just sounds off to me.

Re:Luxon – A library for working with dates and times in JS by seanp2k2 on Sunday November 19, 2017 @12:56AM (#15732494)
Hard drive manufacturers have been doing this for decades. This is why the “80GB” drives were 74.5GB in Windows.

It’s more complicated with SSDs: https://www.anandtech.com/show/2829/7

EDIT: the official “kibibyte” was standardized in 1998: https://physics.nist.gov/cuu/Units/binary.html so almost 20 years ago. Blame Windows and HDD mfgs for sticking with the SI definitions.

Re:Luxon – A library for working with dates and times in JS by sd8dgf8ds8g8dsg on Sunday November 19, 2017 @01:38AM (#15732618)
Yea, bad bad windows for following standards.

The SI prefixes are well established before 1998 and the cause for this brainmelt.

https://en.wikipedia.org/wiki/Metric_prefix

Re:Luxon – A library for working with dates and times in JS by CodesInChaos on Sunday November 19, 2017 @05:08AM (#15733179)
Windows (at least up to 8) does not follow the SI standard. It uses KB, MB, GB but converts using 1024. Which has funny consequences, like 999MB being smaller 0.94GB.
Re:Luxon – A library for working with dates and times in JS by collectively on Sunday November 19, 2017 @03:11AM (#15732853)
Well to be fair “GB” could refer to either prefix.
Re:Luxon – A library for working with dates and times in JS by hjnilsson on Sunday November 19, 2017 @11:32AM (#15734507)
So actually larger than moment (which is 16.3kb gzip)? Hopefully it will improve over time.

API looks better than moment though.