I'm a fan of Moment... it's served me well for most of a decade, including in some really heavy scheduling/timetable applications. The size of importing Moment is really fairly negligible for a full-scale single page app. The one drawback I find with it is the overhead for creating new Moment objects. You never want to, for instance, run through a for/next loop of SQL dates and convert each into a Moment for sorting.…
> The size of importing Moment is really fairly negligible. This attitude is why large parts of the Internet suck these days. I recently visited a friend in Kallithea, Athens, Greece. With his Internet connection, that would add about half a second. It‘s a typical speed for residential connections in Athens.
Day.js – Fast 2kB alternative to Moment.js with the same modern API
131–140 of 141 posts
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#132Earlier quoted context omitted.
The new Temporal API in JS is precisely that.
Yeah, but that’s been just a proposal for a long time. Getting new features in JS takes forever.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#133I have not used moment.js or other date libraries in a long while. But how does this compare to Luxon? ( https://moment.github.io/luxon/#/why )
Full disclosure I haven't used Luxon nearly as much as I've used DayJS, but I would say IMO DayJS is way simpler and more intuitive, this is a very small thing but for example, why would they format Months, by "L" instead of by "M"? The other reason I like DayJS over Luxon is the sheer number of plugins you can pull in to do various things. Like for example I was building an application where I had to build a weekly…
"M" is used for months in Luxon, and is usually what you should use. "L" is only for standalone months, i.e. not within a date string, usually not what you want. In English these are the same thing, but in some languages they are different.
https://github.com/moment/luxon/blob/master/docs/formatting....
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#134Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#135Not sure if this is a gotcha, but how does one make a JS date object (across Safari, FF and Chrome) that refers to the same day of the year regardless of timezone?
You can’t, because JavaScript date objects are just timestamps. Here’s what I wrote on this (along with a small library to handle this problem): https://lisper.in/javascript-date
Edit: looks like I need a date object specifically, so I will go with the timezone conversion method and convert back to timestamp
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#136Earlier quoted context omitted.
Having read the cookbook [1], and wow that's a complex API out there. I can see that there will be a `Temporal Light` to allow us to do `now().startOf('month')` like calls. [1] https://tc39.es/proposal-temporal/docs/cookbook.html
Wouldn't this work? const firstInMonth = Temporal.Now.with({ day: 1 });
Temporal.Now.plainDateISO().with({ day: 1 })
Today (2022-10-10 on my computer), that’ll get you a PlainDate representing 2022-10-01.The “ISO” in there identifies the calendar. Want to know what the first of the current month in the Hebrew calendar is?
Temporal.Now.plainDate("hebrew").with({ day: 1 })
And that gives you 2022-09-26[u-ca=hebrew].Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#137Earlier quoted context omitted.
Must be a euphemism for “300 contributors on a js.org supported GitHub project”.
Immediate hostility and belittling attacks strike again. That was a reply to a comment, not to the code posted. You're being sloppy imprecise and presumptive and expressing it as haughty snide arrogance. Cool attitude
Nothing about that comment was belittling or hostile. It was a bit snarky, but with very good reason, and did not name its target.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#138Earlier quoted context omitted.
How accurate can your critique be if you're so inaccurate in your metaphor for the library authors?
I'm not a primatologist. Tell me if you've ever had this experience. You see something that looks like it's pretty popular. You try it. You find it has nothing but problems. After much research you then find out that other people don't have the level of sophisticated asks for the product and they are doing less complicated and less critical things. It's the disconnect between the hype and the reality that really rubs…
This is so vague. Can you say how you're relating this to dayjs? How is its purpose inauthentic?
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#139It’s functional and tree shakable!
I’ll have to check out Day.js next time though.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#140Earlier quoted context omitted.
Immediate hostility and belittling attacks strike again. That was a reply to a comment, not to the code posted. You're being sloppy imprecise and presumptive and expressing it as haughty snide arrogance. Cool attitude
You are succumbing to the fundamental attribution error. You described your comment being an attack on modern development culture, as your use of euphemism, you chose the insultingly denotative word “kid” to attack the project. Cool attitude, too?
You're being sloppy imprecise and presumptive once again. I'm noticing a pattern here. Let's see if it comes in threes.
And in case you're wondering, you're the one who set the rules of this engagement, I'm only playing by them.
We can be adults any time you want.