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…
Day.js – Fast 2kB alternative to Moment.js with the same modern API
41–50 of 141 posts
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#42Earlier 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…
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 differing written time zones, and you need to account for human readable things like knowing what day of the week it is and what some given locale calls that day.
If you are doing the equivalent of printf debugging with your times, maybe you likely don’t need a time library.
If you are using time as a central part of a distributed algorithm, web content, or a business workflow, then you may likely need a time library.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#43Earlier 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…
Libraries come in handy when doing things that aren’t one liners.
A colleague thought it was super easy to change that exact ISO string to use the local timezone instead of UTC, against my advice. Guess what. The minus sign broke it and he would have never known because most customers are in the US, then they travel to Singapore and your product is worthless. By the time you hear about it, you lost the customer’s money and time therefore you lost the customer.
Moment and Luxon are too heavy, I agree, but date-fns isn’t.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#44What 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
It’s just 140kb extra, don’t worry about it. Repeat 5 times.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#45Earlier 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.
First you have to define what you mean by "one month ago". Is it 30 days ago? Or last month? Or a certain number of milliseconds ago? No library can help you with that. You have to define what you actually want to calculate.
Time libraries can help you with that.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#46I 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…
I've always found moment to just present the same problems you would otherwise have with a few new ones tacked on stated in a different and more complicated way but with a pitch site and artwork. The js date is a bit primitive and moment looks easier but in practice it's actually a convoluted clunky type system that hides important nuance behind impressively bad defaults. I approach all of these "better than what the…
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#47I 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…
I've always found moment to just present the same problems you would otherwise have with a few new ones tacked on stated in a different and more complicated way but with a pitch site and artwork. The js date is a bit primitive and moment looks easier but in practice it's actually a convoluted clunky type system that hides important nuance behind impressively bad defaults. I approach all of these "better than what the…
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#48Earlier quoted context omitted.
I've always found moment to just present the same problems you would otherwise have with a few new ones tacked on stated in a different and more complicated way but with a pitch site and artwork. The js date is a bit primitive and moment looks easier but in practice it's actually a convoluted clunky type system that hides important nuance behind impressively bad defaults. I approach all of these "better than what the…
Who is "some kid"?
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.
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#49Earlier quoted context omitted.
I've always found moment to just present the same problems you would otherwise have with a few new ones tacked on stated in a different and more complicated way but with a pitch site and artwork. The js date is a bit primitive and moment looks easier but in practice it's actually a convoluted clunky type system that hides important nuance behind impressively bad defaults. I approach all of these "better than what the…
Who is "some kid"?
Re: Day.js – Fast 2kB alternative to Moment.js with the same modern API
#50Moment.js objects are mutable [0], and this library's objects are ... immutable.