Live data from Hacker News

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

day.js.org

81–90 of 141 posts

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

#81

Earlier quoted context omitted.

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.

For sure.

Formal peer-review does trump download count, nonetheless.

And I’m all for professional licensure, continuing education programs, and formal, public reviews of the software engineering behind the open source libraries that comprise global infrastructure.

Your main point wasn’t missed.

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

#82
post #27

I never use any date library and I never had a problem with it. I just use what the native Date() object offers. Other devs always say "Just wait, one day it will fall on your feet". But this has been going on for many years, in which my software has served millions of users and nothing ever fell on my feet. I think the complexity of a library like this (423 files, 1433 commits, 53004 lines of code) would have create…

Can you write a one liner to give me the timestamp for start or end of current week, or month? How about a text representation of a difference between two dates? Relative date string (eg. “2 weeks ago”)? Date comparison between two dates that are in different time zones? Does your date calculations take leap hours and leap seconds into account? Date libraries make all these and many more operations a breeze, while rolling these on your own can be tricky, error prone and you’ll be just wasting your time.

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

#83

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.

How accurate can your critique be if you're so inaccurate in your metaphor for the library authors?

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

#85
post #37

Earlier quoted context omitted.

Any operation like adding/substracting months from a date is very messy to implement yourself. What is one month ago when you are March, 31st? We have to deal with monthly subscriptions and it's not fun.

>What is one month ago when you are March, 31st? "one month ago" is between "a few weeks ago" and "a few months ago". >We have to deal with monthly subscriptions and it's not fun. it is a lot less unfun if you define a month as N calendar days in your terms of service, like virtually everyone does

And they would be guilty of misleading the consumer when doing so, and possibly accounting fraud as well because neither GAAP nor IFRS recognise such a calendar; the closest available is the 4-4-5 standard.

This is why we don’t let engineers write contracts. Many seem to think that law is a programming language in which they can redefine reality. It ain’t.

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

#86
post #26

What is the obsession with xKB? With tracking, analytics, monitoring and gazillion other scripts, I'd wager that an average webpage size is probably closer to 1MB. Checked some of the popular sites (caching enabled)- Amazon.com - 4.8MB Google.com - 2.5MB

A bigger library not only cost more time to download, but also more time to parse and execute js code.

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

#88
post #3

Why is this good/better compared to date-fns?

Having used both moment and Luxon in the past, the date-fns API makes no logical sense to me at all.

Interesting, I am the exact opposite. Things like isAfter and addDays as functions just seem so simple.

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

#89
post #27

I never use any date library and I never had a problem with it. I just use what the native Date() object offers. Other devs always say "Just wait, one day it will fall on your feet". But this has been going on for many years, in which my software has served millions of users and nothing ever fell on my feet. I think the complexity of a library like this (423 files, 1433 commits, 53004 lines of code) would have create…

Users in timezone A need to schedule events many months in the future in timezone B, and display them in a report in timezone C.

In addition, should the legal authority in timezone B change their DST rules in the meantime, the local time of the event as observed in timezone B should still be what the user initially selected, which is not the same in UTC as it was at creation time

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

#90
post #27

I never use any date library and I never had a problem with it. I just use what the native Date() object offers. Other devs always say "Just wait, one day it will fall on your feet". But this has been going on for many years, in which my software has served millions of users and nothing ever fell on my feet. I think the complexity of a library like this (423 files, 1433 commits, 53004 lines of code) would have create…

different countries use different date format and also how do you manage languages?
Post reply on HN