Remix.run Logo
bob1029 5 days ago

I like to use the Japanese calendar as an example to scare the juniors away from DIY parsing:

https://learn.microsoft.com/en-us/dotnet/api/system.globaliz...

https://learn.microsoft.com/en-us/windows/apps/design/global...

colesantiago 5 days ago | parent | next [-]

I don’t see anything wrong with this. This is actually a fun challenge.

I encourage everyone to learn how to parse the japanese calendar format.

The more people know the better!

kccqzy 4 days ago | parent | prev | next [-]

Do your users type in such dates? No? Problem solved.

The benefit of DIY parsing is to make the problem simple by restricting it to the set of plausible inputs your users will want your code to handle, not to make a highly general library. The right takeaway for juniors is to stop over-complicating things.

bigstrat2003 4 days ago | parent [-]

> Do your users type in such dates? No? Problem solved.

This is spot on. So many of the "X is really hard and your intuition is wrong" takes ignore the fact that most people are not building something which needs to be usable in every country, language, and culture on this earth. Yes, human behavior is insanely complex, but for any given application you can probably ignore huge swathes of it.

its-summertime 4 days ago | parent | prev [-]

I put these into an ISO8601 parser and it didn't work, I'm going to tell ISO off for obviously DIYing their solution instead of doing the proper thing.