Live data from Hacker News

Day.js – Fast 2kB alternative to Moment.js with the same modern API

day.js.org

51–60 of 141 posts

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#52

Earlier quoted context omitted.

Who is "some kid"?

Intentionally unspecified. This isn't a personal attack but instead a systemic and cultural critique It's been like this for decades. Emotional salience sells software better than hard practicality to just about everyone. Then people rationalize their irrational choices then the timeline slips and the product sucks. You can just sit and watch it play out like someone studying monkeys. It's remarkably predicable.

As important as the relatively low file size is for the utility of this library, the API compatibility with Moment is perhaps the magnum opus.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#53
post #41
post #34

Earlier quoted context omitted.

This was the reply I was trying to prevent by saying "minimal code example". I'm not interested in long theoretical articles. But I would look at a few lines of code. Here is an example of some code I recently wrote: logEvent { 'date': new Date().toISOString(), 'event': 'image_updated', 'value': image['id'], } This logs that an image with a given id was updated. Why would I trade in my single date line for 423 files…

This is only you having super basic date needs, not Day.js being overkill in general.

Any system, no matter how complex, can be composed of smaller units that only have super basic needs.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#54
post #24

There's an error in the documentation. What's the standard procedure to submit a pull request or bug report here? The docs subdirectory just links to the website and I couldn't find them in the gh-pages branch, either.

Probably a good question to ask here: https://gitter.im/iamkun/dayjs

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#55
post #34

Earlier quoted context omitted.

This was the reply I was trying to prevent by saying "minimal code example". I'm not interested in long theoretical articles. But I would look at a few lines of code. Here is an example of some code I recently wrote: logEvent { 'date': new Date().toISOString(), 'event': 'image_updated', 'value': image['id'], } This logs that an image with a given id was updated. Why would I trade in my single date line for 423 files…

> I'm not interested in long theoretical articles Those articles are more empirical in nature than theoretical. > This logs that an image with a given id was updated As a thought exercise, imagine that your log trail needed to be created in a distributed system, spanning multiple machine time zones, or that you needed to build a report that is read from browsers in multiple time zones that differ from multiple differ…

You are trying to convince me with the popular "This is not going to work for a much more complex system".

I heard it very often. I don't buy it. Any system, no matter how complex, can be composed of small, simple systems.

I never ran against a "complexity wall" when writing software in a lean way and suddenly thought "Damn, those tens of thousands of lines of library code now would be the better approach".

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#56
post #34
post #29

Earlier quoted context omitted.

Examples of essential complexity you have to worry about if you want your code to be correct, and even if you want to test/detect all issues that can/do come up: - https://infiniteundo.com/post/25326999628/falsehoods-program... - https://infiniteundo.com/post/25509354022/more-falsehoods-pr... In my experience engineers will often brush these sorts of things off as “edge cases”, but really all of these complexities ar…

This was the reply I was trying to prevent by saying "minimal code example". I'm not interested in long theoretical articles. But I would look at a few lines of code. Here is an example of some code I recently wrote: logEvent { 'date': new Date().toISOString(), 'event': 'image_updated', 'value': image['id'], } This logs that an image with a given id was updated. Why would I trade in my single date line for 423 files…

Moment and friends shine when you need to display and interact with dates from a human perspective. Calendars, scheduled events, etc., all are hard to do without something like moment.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#57

Earlier quoted context omitted.

Intentionally unspecified. This isn't a personal attack but instead a systemic and cultural critique It's been like this for decades. Emotional salience sells software better than hard practicality to just about everyone. Then people rationalize their irrational choices then the timeline slips and the product sucks. You can just sit and watch it play out like someone studying monkeys. It's remarkably predicable.

As important as the relatively low file size is for the utility of this library, the API compatibility with Moment is perhaps the magnum opus.

Absolutely. Great job. No question. Everyone should build things and follow their heart. Full stop.

This wasn't anything about the posted software. It was a reply to a comment.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#59
If you are considering switching to a (different) date library, I would suggest to hold off. ECMAScript is about to introduce a native date and time API that is much better than the current Date functionality. It may also make the need for a third-party date library obsolete (as long as you do not need to parse custom date formats).

- https://github.com/tc39/proposal-temporal

- https://github.com/tc39/proposal-temporal#polyfills

- https://tc39.es/proposal-temporal/

- https://tc39.es/proposal-temporal/docs/index.html

- https://github.com/tc39/proposal-temporal/issues/1450

- https://tc39.es/proposal-temporal/docs/parse-draft.html

As far as I know, issue #1450 is the last remaining blocker for the standardization. I'd assume that this will be resolved in the next months. So Temporal will likely be officially released with ECMAScript 2023, but browser vendors and other implementors will start shipping it before the offical release.

Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API

#60
post #55

Earlier quoted context omitted.

> I'm not interested in long theoretical articles Those articles are more empirical in nature than theoretical. > This logs that an image with a given id was updated As a thought exercise, imagine that your log trail needed to be created in a distributed system, spanning multiple machine time zones, or that you needed to build a report that is read from browsers in multiple time zones that differ from multiple differ…

You are trying to convince me with the popular "This is not going to work for a much more complex system". I heard it very often. I don't buy it. Any system, no matter how complex, can be composed of small, simple systems. I never ran against a "complexity wall" when writing software in a lean way and suddenly thought "Damn, those tens of thousands of lines of library code now would be the better approach".

That’s very true. A colleague recently started using the same method and is achieving bundles and dependencies orders of magnitude smaller. As a result, he has to care less about security, build times and build breaks and spends more time coding. Developers have unlearned to build basic functionality apparently, especially in the front end area.
Post reply on HN