Never write your own date parsing library

2025-07-2517:36265321www.zachleat.com

A post by Zach Leatherman (zachleat)

Never write your own date parsing library.

Never. No exceptions.

Never have I ever…

So… I’ve written my own date parsing library.

Why? Our story begins seven years ago in the year 2018. I made the very sensible choice to adopt luxon as the Date Parsing library for Eleventy. This parsing behavior is used when Eleventy finds a String for the date value in the Data Cascade (though YAML front matter will bypass this behavior when encountering a YAML-compatible date).

This choice was good for Eleventy’s Node.js-only requirements at the time: accurate and not too big (relatively speaking). Eleventy has used luxon since @0.2.12 and has grown with the dependency all the way through @3.7.1. Now that’s what I call a high quality dependency!

As we move Eleventy to run in more JavaScript environments and runtimes (including on the client) we’ve had to take a hard look at our use of Luxon, currently our largest dependency:

  • 4.7 MB of 21.3 MB (22%) of @11ty/eleventy node_modules
  • 229 kB of 806 kB (28%) of @11ty/client (not yet released!) bundle size (unminified)

Given that our use of Luxon is strictly limited to the DateTime.fromISO function for ISO 8601 date parsing (not formatting or display), it would have been nice to enable tree-shaking on the Luxon library to reduce its size in the bundle (though that wouldn’t have helped the node_modules size, I might have settled for that trade-off). Unfortunately, Luxon does not yet support tree-shaking so it’s an all or nothing for the bundle.

The Search Begins

I did the next sensible thing and looked at a few alternatives:

Package Type Disk Size Bundle Size
luxon@3.7.1 Dual 4.59 MB 81.6 kB (min)
moment@2.30.1 CJS 4.35 MB 294.9 kB (min)
dayjs@1.11.13 CJS 670 kB 6.9 kB (min)
date-fns@4.1.0 Dual 22.6 MB 77.2 kB (min)

The next in line to the throne was clearly dayjs, which is small on disk and in bundle size. Unfortunately I found it to be inaccurate: dayjs fails about 80 of the 228 tests in the test suite I’m using moving forward.

As an aside, this search has made me tempted to ask: do we need to keep Dual publishing packages? I prefer ESM over CJS but maybe just pick one?

Breaking Changes

Most date parsing woes (in my opinion) come from ambiguity: from supporting too many formats or attempting maximum flexibility in parsing. And guess what: ISO 8601 is a big ’ol standard with a lot of subformats. There is a maintenance freedom and simplicity in strict parsing requirements (don’t let XHTML hear me say that).

Consider "200". Is this the year 200? Is this the 200th day of the current year? Surprise, in ISO 8601 it’s neither — it’s a decade, spanning from the year 2000 to the year 2010. And "20" is the century from the year 2000 to the year 2100.

Moving forward, we’re tightening up the default date parsing in Eleventy (this is configurable — keep using Luxon if you want!).

Luckily we have a north star date format: RFC 9557, billed as “an extension to the ISO 8601 / RFC 3339” formats and already in use by the upcoming Temporal web standard APIs for date and time parsing coming to a JavaScript runtime near you.

There are a few notable differences:

Format ISO 8601 Date.parse* luxon RFC 9557
YYYY
YYYY-MM
YYYY-MM-DD
±YYYYYY-MM-DD
Optional - delimiters in dates
YYYY-MM-DDTHH
YYYY-MM-DD HH (space delimiter)
YYYY-MM-DDtHH (lowercase delimiter)
YYYY-MM-DDTHH:II
YYYY-MM-DDTHH:II:SS
Optional : delimiters in time
YYYY-MM-DDTHH:II:SS.SSS
YYYY-MM-DDTHH:II:SS,SSS
Microseconds (6 digit precision)
Nanoseconds (9 digit precision)
YYYY-MM-DDTHH.H Fractional hours
YYYY-MM-DDTHH:II.I Fractional minutes
YYYY-W01 ISO Week Date
YYYY-DDD Year Day
HH:II
YYYY-MM-DDTHH:II:SSZ
YYYY-MM-DDTHH:II:SS±00
YYYY-MM-DDTHH:II:SS±00:00
YYYY-MM-DDTHH:II:SS±0000
Unsupported
Inaccurate parsing
Face looking surprised
Surprising (to me)

* Note that Date.parse results may be browser/runtime dependent. The results above were generated from Node.js.

A new challenger appears

It is with a little trepidation that I have shipped @11ty/parse-date-strings, a new RFC 9557 compatible date parsing library that Eleventy will use moving forward.

The support table of this library matches the RFC 9557 column documented above. It’s focused on parsing only and our full test suite compares outputs with both the upcoming Temporal API and existing Luxon output.

While there are a few breaking changes when compared with Luxon output (noted above), this swap will ultimately prepare us for native Temporal support without breaking changes later!

This library saves ~230 kB in the upcoming @11ty/client bundle. It should also allow @11ty/eleventy node_modules install weight to drop from 21.3 MB to 16.6 MB. (Some folks might remember when @11ty/eleventy@1 weighed in at 155 MB!)

Late Additions

For posterity, here are a few other alternative date libraries / Temporal polyfills that I think are worth mentioning (and might help you in different ways on your own date parsing journey):


Read the original article

Comments

  • By quelsolaar 2025-07-2520:3830 reply

    When ever i see "never implement your own...", i know i want to implement it myself. People say that about hard things, and I only want to do hard things. Nobody wants people who can do easy things, people want people who can do hard things. The only way to learn how to do hard things, is to do hard things, so do the hardest things.

    So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard.

    • By glibby 2025-07-2520:457 reply

      By all means, write it. Just don't use it. These warnings are almost always in the context of code you're going to release, not exercises in learning on your own.

      • By kuon 2025-07-269:135 reply

        Hard disagree here. Use it. Of course, if you running code that drive a pacemaker or a train maybe be careful, but in general, do things. We don't want a world where only three old bearded guys can write a compiler or a physic engine. Do the same errors again and you'll learn, eventually you'll do better than those who were here before you.

        • By sabas123 2025-07-2611:43

          > We don't want a world where only three old bearded guys can write a compiler or a physic engine.

          Don't write your own OS does not mean do not contribute to something like the linux kernel.

        • By patrick0d 2025-07-2611:42

          Well don't do it and instead of using an off the shelf library that is known to work while the rest of the development team isn't reinventing the wheel. Doing it for fun and education is fine of course.

        • By breatheoften 2025-07-2621:001 reply

          What IS the right way to model dates in a pacemaker ...? I hope the answer is "just don't do it" -- but I don't know what reasons there might be for a pacemaker to need to depend on calendar dates in order to best do its job ...

          • By fc417fc802 2025-07-2622:581 reply

            Well naturally it will need to connect to your phone via Bluetooth for the app to proxy update downloads and historic location data uploads. But in order to do anything on the network securely you need an accurate clock and the ability to parse datetimes because the PKI implementation depends on that.

            Then the app pings you to remind you that your premium subscription will be expiring soon after which your heart rate will be limited to 100 bpm or less.

            • By 1718627440 2025-07-287:32

              Hopefully no real pacemaker manufacturer is allowed to do that. Creating radiation in the middle of a body near a critical organ without a medical reason sounds like a really dumb idea.

              Also you want the pacemaker to be as air-gapped and simple as possible, because it needs 100% uptime.

              (maybe I missed the implied /s)

        • By Hnrobert42 2025-07-2611:18

          >Maybe be careful

          Really?

        • By Zambyte 2025-07-2612:47

          It's interesting that people are disagreeing with you in a way that they're making it sound like they're elaborating on your point.

          To the people reading this, please don't just disagree with an "obvious counterexample". Explain why!

      • By flir 2025-07-2521:453 reply

        In the case of date libraries, I think if I ported the tests from a few well-known libraries to my own, I'd have reasonable confidence in my own.

        Having said that, I don't think date libraries are hard, I think they're messy. Mostly because humans keep introducing convenience fudges - adding a second here, taking eleven days off there, that kind of thing.

        • By benlivengood 2025-07-2522:141 reply

          I would not be surprised if the state of unit tests on good date parsing libraries are not sufficient to design a new one from scratch.

          See the number of unit tests in the Linux kernel, for example.

          • By flir 2025-07-2522:271 reply

            You might be right, I haven't checked. It just seems on the face of it such an easy thing to test. Scalars go in, scalars come out. (This could just be me doing the Dunning-Kruger thing).

            You could run a fuzzer against two libraries at the same time to find discrepancies....... hmm. That might actually be a good exercise.

        • By tbrownaw 2025-07-263:19

          > Having said that, I don't think date libraries are hard, I think they're messy.

          Messy is just a particular kind of tedious which is the most common form of hard.

          It's not like typical things that need doing tend to include solving lots of unsolved problems.

        • By shakna 2025-07-262:18

          Most well-known date library systems have failed in places. Quite a few, still do. So whilst you might get some known regression to test against, nothing can give you a foolproof guide.

          You can have reasonable confidence that here there be dragons, but not so much that your assumptions about something will hold.

      • By bdangubic 2025-07-262:331 reply

        I write my own, but in production I always use libraries written by some dude from Omaha :)

        • By dylan604 2025-07-266:18

          And that dude is no longer actively maintaining it and you just discovered an issue with it.

      • By cmdlyne2 2025-07-2612:03

        > By all means, write it. Just don't use it.

        I'd say write it, probably don't use it, and don't share it unless it's substantially better than the alternative.

        This way, you'll learn about it, but you'll more likely stay with something standard that everyone else is using, and you don't share yet another library that wastes others' time and your own (having to read about it, evaluate it, use it, and the migrate off of it when it's abandoned).

      • By ramijames 2025-07-2520:584 reply

        This is such nonsense. All the stuff that we use, someone wrote. If nobody makes them, then how is that going to work?

        The messaging here is that you should be careful about using what you build on your own because it:

        - hasn't been battle tested

        - likely has bugs

        - isn't mature

        The only way that it will be all of those things is if someone invests time and energy in them.

        From an ecosystem perspective this is absolutely the right thing. You want duplicate projects. You want choice. You want critical knowledge to be spread around.

        • By Swizec 2025-07-2521:061 reply

          > If nobody makes them, then how is that going to work?

          I see it as “Dont write your own X, unless you want to maintain X. Here be dragons, this problem is deeper than it appears, the first 80% will be easy, the next 15% will annoy you, and the last 5% will consume your life for weeks, months, or even years. Or you could use a library”

          • By ahartmetz 2025-07-2623:59

            The latter, if you want to get it completely right. I occasionally read the commits in the Qt framework, and from that, I can tell you that date-time stuff is complicated, and not in an instructive way, but in a super tedious way.

        • By mattmanser 2025-07-2521:122 reply

          It's about exposure.

          The things that people write that everyone uses have had HUGE exposure.

          They've been exposed to all the edge cases, they've been tested millions, if not billions of times. All the bugs ironed out.

          The people who've worked on them are now the greatest domain experts on that little corner of comp-sci.

          Yours won't unless it hits prime time.

          So yours will be weak, brittle and dangerous.

          • By zelphirkalt 2025-07-2612:16

            This assumes, that the practices/methods used to create a working library are suitable for solving the problems. They might be ill-advised and include tons of workarounds for bad design decisions. Too often following the advice of never reinventing anything (and possibly doing better), is how we ended up with stacking broken stuff on top of other broken stuff, limiting us at every turn with leaking abstractions and bad designs.

            It is very possible to have a clean implementation with good design choices overtake an established in time, enabling more extensibility, modularity and maintainability.

            An example: People still way over-use regexes for all kinds of stuff. Even in code editors people for syntax recognition, where people really should know better.

          • By gmueckl 2025-07-2521:382 reply

            In order to have these mature libraries, someone hat to start building them. They all had to to be incomplete, immature and horribly buggy early in their lifetime, too.

            • By immibis 2025-07-260:02

              Yeah, so do you want to go through that process of shipping broken crap and fixing user complaints one at a time until it happens to work for everyone, which is a mandatory process for all new libraries in one of these areas to go through, or would you rather stand on the shoulders of someone who's already done it?

            • By kulahan 2025-07-261:561 reply

              Why would I mature yours and deal with those issues when I can just use the already-mature one?

              • By gmueckl 2025-07-264:561 reply

                You assume that you always have a mature option available. That's (a) definitely not a totally generalizable assumption and (b) my point is that mature options only exist because the people that developed them just did it when confronted with the task.

                • By kulahan 2025-07-2622:591 reply

                  We are specifically talking about something that does have a mature option available. That’s why it’s stupid to try and implement your own version of something complex.

                  If you change the story such that the product is actually needed and universally immature, of course building it is a valid argument.

                  Regarding b: Right, and the point of this article is that for those types of things, go for the already-mature thing. You’re arguing a point nobody is making.

                  • By gmueckl 2025-07-279:29

                    I'm not changing any story here. All this "use a library" advice to juniors isn't as universal amd fast as everybody makes it sound. I always find that it sounds too discouraging. There is no magic in these libraries and in their creation - just time and effort. And that's something that needs to be mentioned, too. You can roll your own if you're willing to justify the effort. Depending on the context, it may just not be a good use of your time.

                    That's why it's also important to point out that no significant piece of code is mature and stable from the start, but was brought into this state iteratively using tools and processes that are available to everybody else, too. The biggest difference between existing mature code and new code under any good development process is age.

        • By ozim 2025-07-2522:101 reply

          I think there is missing point in this discussion.

          Most of the time you build something else.

          Like if you build a todo app and have to deal with scheduling you don’t spend time making date library because it’s not your goal. But people would do that.

          Heck most developers instead of starting blog on a blog platform start writing code for their own blogging engine.

        • By DANmode 2025-07-2521:111 reply

          Holy shit.

          The point is, before you release your new thing, make sure it addresses all of the pain points the previous solutions have already slogged through,

          or that if it doesn't, people are still aware of when they can arise, and why your thing has chosen not to mitigate them yet,

          or ever, if it's an opinionated piece of tech.

          • By commandlinefan 2025-07-2521:36

            Nah, finding that stuff is what users are for.

      • By bigstrat2003 2025-07-263:452 reply

        I think that advice makes sense in the context of cryptography, where the consequences for getting it wrong can be quite serious indeed. I don't think it holds true for something as unimportant as a date parsing library.

        • By poink 2025-07-263:592 reply

          Correct date handling (including parsing) can be monumentally important. Imagine an app that reminds people when to take their medications, for example

          • By what 2025-07-264:462 reply

            You typically take medication at a set time every day. You don’t need to parse dates for that.

            • By poink 2025-07-265:04

              1) Dates are often stored as strings, so parsing them correctly is a necessary component of storing them. Also, those dates need not be simple app state. They could come from an API provided by your doctor/pharmacy

              2) Many people (especially the elderly) take enough medications on different schedules that managing them all would be a significant cognitive load for anyone

              It’s just an illustrative example, though. My point is getting dates right (including parsing their string representations) often matters quite a bit. If you disagree, let’s argue about that rather than quibble about the minutiae of the example

          • By computerthings 2025-07-2615:45

            [dead]

        • By leptons 2025-07-265:38

          A lot of cryptography relies on dates, time, etc.

    • By mikepurvis 2025-07-2616:043 reply

      Some things are good hard, the kind of hard that's driven by an interesting domain, going deep with well-architected tools or systems, learning lots of cool stuff.

      I expect datetime-adjacent code is basically the opposite of all of this. All the hard parts are driven by fiddly adherence to real-world geography, politics, physics/astronomy, etc. There's no underlying consistency from which a sane model can be extracted, it's just special cases and arbitrary parameters all the way down.

      I'm up for a challenge of course, but all else being equal, I'm happy to leave work that is the "bad hard" to others.

      • By yes_man 2025-07-2620:571 reply

        Reminds me of this passage from Postgres documentation:

        ”As an example, 2014-06-04 12:00 America/New_York represents noon local time in New York, which for this particular date was Eastern Daylight Time (UTC-4). So 2014-06-04 12:00 EDT specifies that same time instant. But 2014-06-04 12:00 EST specifies noon Eastern Standard Time (UTC-5), regardless of whether daylight savings was nominally in effect on that date. … To complicate matters, some jurisdictions have used the same timezone abbreviation to mean different UTC offsets at different times; for example, in Moscow MSK has meant UTC+3 in some years and UTC+4 in others.”

        Parsing datetimes indeed sounds like a challenge in collecting, knowing and maintaining all these warped out standards and compromises. ”Bad hard” is a great description

        • By popoflojo 2025-07-274:381 reply

          Leap seconds are when it really gets fun.

          • By gus_tpm 2025-07-279:17

            I will never not be impressed with how well we are able to keep track of time in the world

      • By bapak 2025-07-2619:06

        Correct. It's not hard, just stupidly time consuming to the point of being unable to ever produce anything that works 70% of the time.

        I hate anyone who will attempt to craft their own 10-lines line parser and then ignore that it fails 4 times a day. Just use the damn library. Thank you.

        Write it for fun, but don't ship it. You're wasting everyone's time with your craft.

      • By taneq 2025-07-272:46

        Exactly. It’s not hard, just annoying.

    • By leakycap 2025-07-2520:473 reply

      I get wanting to do hard things, but do you write in binary? Do you crank your own electricity?

      My most valuable resource is time. Sure, I could learn more low-level aspects of my craft ... and sometimes I find it useful to do so.

      When I focus on doing the hardest, already solved things by re-implementing them my own way, what value am I adding?

      I've never met a client who cared about a library or how I did something in code - until it broke. Then, they didn't care who wrote it, they just cared it started working again.

      • By quelsolaar 2025-07-267:06

        Writing in binary or cranking your own electricity is easy. Anyone can do it.

        There is a difference between things that are difficult and things that just take a lot of work.

      • By ok_dad 2025-07-2521:481 reply

        People have built tables but I still build tables myself. Not as many people will use them as people who use IKEA tables, but that’s okay, I’m still going to build them.

        • By leakycap 2025-07-2523:501 reply

          I don't think tables are the hard thing.

          If you wanted to grow your wood, plane and dry it yourself, etc... then you'd be "hard way" building a table.

          I assume you use tools?

          • By ok_dad 2025-07-262:361 reply

            I mean, a table is as hard as you make it. I work with rough construction lumber, and make nice finished goods, my point was that people still do stuff that isn’t worth their time financially.

            • By leakycap 2025-07-265:101 reply

              > I mean, a table is as hard as you make it.

              We aren't talking about the same thing: I stated "I don't think tables are the hard thing."

              Note the word "the" in front of "hard thing" -- I'm referencing the article we're discussing, which mentions "the hard thing"

              • By fc417fc802 2025-07-2623:111 reply

                The entire process is "the thing". In the case of a table by adjusting the inputs to the process you can cover quite a wide range of difficulty and required time.

                For example, start from a felled tree, use only hand tools, and assemble using medieval joinery techniques. Building a table that way is quite hard by modern standards.

                Now if you'll excuse me I need to get back to writing this date parsing library in assembly.

                • By ok_dad 2025-07-270:59

                  Not even doing it from scratch is the hard thing, the hard thing is getting the experience to know how to fit stuff together the best way to achieve your design and utilitarian goals, what wood to use, etc.

                  The hard thing isn’t building the date parsing library in assembly, it’s learning assembly well enough to do it in the first place.

                  I’m not sure where this discussion began but I was rebelling against everyone who says “just buy it” in regards to anything hard to do.

      • By cortesoft 2025-07-263:01

        > I've never met a client

        There is difference between “never build your own for a professional need” and “never build your own”.

        I build my own stuff if it is for my own purposes, and I use proper tools and libraries for my professional work.

    • By avanwyk 2025-07-2522:373 reply

      I can't believe this is such a controversial take. Solving hard things by yourself is growth. I 100% agree, rather solve a hard solved problem yourself than learning yet another JS framework or launching yet another revenue losing SaaS ("successful" because of VC). Or whatever. Push hard boundaries.

      • By stouset 2025-07-2523:542 reply

        Nobody is really saying not to build these things. They’re saying the problem is exceedingly annoying to solve—and often not in a technically interesting way but in a way that is just massively tedious—and a better alternative almost certainly already exists.

        If you want to build it to scratch an itch, go ahead. If you want to build it for fun, go ahead. If you want to build it because an existing solution gets something wrong and you can do better, go ahead (but know that it is a way bigger undertaking than you might assume at first glance).

        The real advice is “don’t casually build your own X”, but that’s less punchy.

        • By immibis 2025-07-260:07

          An exemplary one is "don't build your own timezone database"

          It's not interesting, it's not fun, it's just a process of getting complaints it's wrong in edge cases and then fixing them, over and over until no one can find another broken edge case.

          You can start by writing down England is +0, Germany is +2, etc... someone's going to mention DST and you'll put in a field for switching on the Nth Sunday of month X... later you'll run into a country that uses a different rule and you'll add a bunch of spaghetti code or write a Turing-complete DSL, etc... One day someone tells you about a village where they count 17 hour days on seashells and then you'll give up.

          And if your DB doesn't produce identical results to the Olson DB in all cases then you created an incompatibility anyway. Might as well just use the Olson DB.

        • By thfuran 2025-07-2610:41

          >If you want to build it because an existing solution gets something wrong and you can do better, go ahead

          But please at least file the bug first.

      • By myaccountonhn 2025-07-2619:34

        I think it's a spectrum and most fall somewhere on the line, hopefully dependent on the project.

        My personal limit is rolling my own crypto, but I'm definitely more on the DIY scale because I agree. It's a fantastic way to grow and learn, and it's likely you might not have the energy to do it outside of work.

      • By brianpan 2025-07-2522:44

        It's controversial because 1) good on someone for wanting to do something difficult and 2) I cannot think of a worse thing to try to implement. Maybe trying to parse the world's postal and street addresses is a close second?

        Just, why.

    • By chii 2025-07-266:086 reply

      > The only way to learn how to do hard things, is to do hard things, so do the hardest things.

      and i don't want to pay my employees to learn, i want to pay them to produce output i can sell.

      Doing hard things are good, if this hard thing has never been done before - like going to the moon.

      Doing hard things which has been done, but just not by you, is not good unless it's for "entertainment" and personal development purposes - which is fine and i encourage people to do it, on their own dime. Like climbing Mount Everest, or going to the south pole.

      But if you are doing a project for someone else, you don't get to piggy back your personal wants and desires unrelated to the project on to it.

      • By schindlabua 2025-07-266:472 reply

        Except making employers do only easy things will make them stagnate. People who do nothing but simple CRUD apps over and over won't even be particularly good at making CRUD apps... whereas the guy who builds an Unicode font renderer in his free time always seems to write better code for some reason.

        Getting better at your job is not just a "personal want" but very much something that the employer appreciates aswell.

        Of course reinventing the wheel isn't good in corporate because the reinvented wheel is buggier than the ready made npm package but employers should go out of their way to find hard problems to solve that they can pass to their employees. It's called a growth opportunity.

        • By keybored 2025-07-269:17

          You can’t convince an employer with that attitude. They’re gonna keep exploiting their employees and “encourage” them to do their “personal development” in their free time.

        • By pjmlp 2025-07-267:42

          Unless you work for enterprise consulting where employers appreciate replaceable cogs that they randomly drop into any project, and nicely out project budget regardless of delivery quality.

      • By ahf8Aithaex7Nai 2025-07-266:561 reply

        > and i don't want to pay my employees to learn, i want to pay them to produce output i can sell.

        This can be a bad local optimum. It probably depends on what exactly your business does, but it can make sense to pay an employee to acquire knowledge and skills that are needed in the business. You can't buy this off the shelf in all circumstances. Of course, it also has to make economic sense and be viable for the company. Unfortunately, I often see employees doing things quite badly that they don't really understand because they are not given the opportunity to learn properly. I can't imagine that this burns less money in the medium and long term than giving paid employees adequate space to learn.

        • By pletnes 2025-07-267:241 reply

          Also as an employee, this forces me to job hop to stay relevant.

          • By pjmlp 2025-07-267:431 reply

            Unless you happen to live in cultures where that is looked down upon as not able to keep a job.

            • By pletnes 2025-07-2614:10

              Meaning you will job hop less, but you still have to weigh the advantage/disadvantage as always.

      • By d_tr 2025-07-267:47

        I am in a work environment where I actually get to do hard shit for fun, learn a ton, and also "get stuff done" and my employer is happy.

        For some of the stuff that has been done already, it might still make sense to do your own implementation, for example if you want to be able to experiment without having to navigate and learn a huge codebase and then have to maintain a fork just to have your own stuff in.

        Another project we are starting now involves replacing software which is outright crappy and wastes our time. Thankfully my employer was able to see and understand this after talking it through with them.

      • By quelsolaar 2025-07-267:011 reply

        Your customers will pay more for things that are hard to do. Ask ASML.

        • By motorest 2025-07-267:042 reply

          > Your customers will pay more for things that are hard to do. Ask ASML.

          What a silly example. ASML is valuable because it does something no one else does. It's not because it's hard, it's because they have the know-how and infrastructure to do it whereas others don't.

          Juggling is hard. Do you know any millionaire jugglers?

          • By seb1204 2025-07-2613:43

            No one else does it, because it is hard I thought? Hard to get all the steps and processes aligned to produce what they do. It is so hard, that there is no rich guy that wants to throw money in the hat and do it himself.

          • By bdhcuidbebe 2025-07-268:00

            > Juggling is hard.

            You should try instead.

            I brought jugglers balls for my team and in a few weeks we had 4 or 5 fluent.

      • By bdhcuidbebe 2025-07-267:561 reply

        > i don't want to pay my employees to learn

        Then how do you expect them to learn?

        Good luck getting more blood out of that stone, smh.

        • By Latty 2025-07-269:23

          Let's be a little charitable and assume they mean just learn. There are hard tasks you can learn from that also provide something you can't just get off the shelf, rather than just reimplementing the wheel.

      • By rambambram 2025-07-267:59

        Is quelsolaar your employee?

    • By motorest 2025-07-267:01

      > People say that about hard things, and I only want to do hard things.

      That's perfectly fine. Your time, your hobbies.

      > Nobody wants people who can do easy things, people want people who can do hard things.

      No, not really. People want people who do easy things, because they are clever enough to avoid needlessly wasting their time having to do hard things when they could have easily avoided it.

      It's your blend of foolish mindset that brought us so many accidental complexity and overdue projects. There's a saying: working smart instead of working hard.

      > So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard.

      You can cut it out, this isn't LinkedIn.

    • By kurikuri 2025-07-2612:48

      > When ever i see "never implement your own...", i know i want to implement it myself.

      Doing stuff for learning is useful, and the intent behind this general phrase is to not ‘implement your own’ something which is both hard and critical in a production environment. I work in cryptography (for security purposes) and have implemented quite a few things myself to learn, but I still use stable, field tested, and scrutinized crypto for any actual use.

      > People say that about hard things, and I only want to do hard things. Nobody wants people who can do easy things, people want people who can do hard things.

      Only wanting to do hard things limits yourself quite a bit: what about things which seem easy but could be improved? I worked in a non-tech related medical manufacturing job for a bit and took time to learn the process and tools. Afterward, I implemented a few tools (using what my coworkers (who have no programming or IT experience) have available to them: Excel and the VBA on the lab computers) to help them prep inventory lists which they have been doing by hand. Doing it by hand took them 3 hours as a group (and the first shift had to do this every morning), which my tool did in 5 seconds with a single button click. They still use it to this day, about a decade later.

      This wasn’t something ‘hard:’ I glued a few files together, grouped a list by a filter, sorted the groups by a column, and made a printout which was easy to read and mark on as they went about their day. However, my coworkers didn’t even know this was possible until someone came in with a different skill set, learned what they did (by doing the job well for months) and then made a solution.

      You must be careful with doing only ‘hard’ things. It requires other people to identify what is hard! In addition: crackpots do only hard things and believe they find better solutions than what exists so far (without consulting or learning about what has been done). Interesting people learn about things as they are (with the humility of knowing that they are not experts in most things) and tries to improve them using the knowledge they already have.

      Don’t waste your time rolling your own crypto when you could do the _actual_ hard thing and identify unaddressed space to make careful and considered improvements.

    • By dracodoc 2025-07-2523:381 reply

      It's not because it's "hard".

      It's all about the nuisance created by human behavior. Calendar, DST, timezone, all the problems you never imagined can happen and can only be met in real life scenarios, and you will meet same problem again, struggle then found out the same problem have been solved long time ago by mature library, and the solution doesn't require any smart or advanced technique, just another corner case.

      • By geocar 2025-07-265:58

        I disagree hard.

        Firstly because I have a great imagination, but secondly because I am old and have a lot of real life scenarios to think about.

        State-of-the-art here has changed a few times in my professional career: Once upon a time most time/date libraries used a single integral type and try to make it do double-duty by being both interval and absolute (whatever that means) time by taking the interval from an epoch.

        Relatively recently however, that's started to change, and that change has been made possible by people using languages with better type systems reinventing the date/time approach. This has led to fewer bugs, and more predictability with regards to calendar operations in different programs.

        But bugs still happen, so this approach is still unsatisfying. One thing I keep having to worry about is distance; I record RTT as part of my events, since when I am looking for contemporaneous events, the speed-of-light actually tends to be a real factor for me.

        So I don't think this is solved simply because my problems aren't solved by existing libraries, and I keep getting into arguments with people who think GMT=TAI or something dumb like that.

        It's not "all about" anything: Nobody knows shit about what's happening in the next room over, and if there are 12 different date/time libraries now, I guarantee there'll be a 13th that solves problems in all of them, and is still incomplete.

    • By VohuMana 2025-07-2521:16

      I think in the case of the article the date library isn't necessarily hard but tedious. They mention most date libraries suffer from supporting too many standards or allow ambiguity.

      I agree with you though, do the hard things even if it doesn't work 100% right you will have learned a lot. In university I had to implement all of the standard template library data structures and their features, it wasn't as robust as the actual STL but the knowledge of how those work under the covers still comes up in my day to day job.

    • By psychoslave 2025-07-266:51

      There are different kind of hardship though.

      There things which was a result will make your mind click to an other way to comprehend a problem space and how to navigate through it.

      And there are things which are hard due to pure accumulation of concurrent conventions, because of reasons like coordinating the whole humanity toward harmony with full happy peaceful agreement of everyone is tricky.

      Handling date is rather the latter. If you dig in the lucky direction, you might also fall into cosmological consideration which is a rabbit hole of its own, but basically that's it: calendars are a mess.

    • By gjm11 2025-07-2610:14

      I find this a perplexing comment in view of the fact that almost all of the linked article is in fact about how the author wrote his own date parsing library; the "never do it" bit is just a couple of lines at the start and so far as I can tell is mostly there for fun.

      (In particular, at no point does the article actually argue for not writing your own date parsing library. It just says, in essence, "Never do it. I did it. Here's what I did and why.")

    • By ozim 2025-07-266:00

      Missing context is - there is always something else you work on like the guy was making Eleventy so it was waste of his time.

      If you work for a company and build todo app most likely it will not be beneficial for you to implement in-house library because there will be stuff that will bring much more value.

      Like you don't have now 2 years to cover for all hard stuff because you have to make synchronization of tasks between devices and your boss most likely won't appreciate that.

      "Never roll your own cryptography" is always used in context of building another application it is never "don't become a cryptography specialist".

    • By nicoburns 2025-07-2616:55

      > So go ahead, write your own date library, your own Unicode font rendering, compiler, OS, game engine or what ever else people tell you to never do because its hard.

      You can absolutely do these things. What you need to be aware of is that in most cases maintaining these things to a production quality level is full-time job for a talented engineer. So you shouldn't attempt these IF:

      - You have a higher-level aim you are also trying to achieve

      - You need a production quality implementation

      If one of those isn't the case then knock yourself out.

    • By rkagerer 2025-07-2523:41

      Don't forget to roll your own crypto libraries.

    • By qwertox 2025-07-2521:042 reply

      This past 22nd of July was the shortest recorded day [0]. How would your library handle this?

      [0] https://www.space.com/astronomy/earth/earth-will-spin-faster...

      • By gmueckl 2025-07-2521:40

        Answer: not at all, unless I had to deal with astronomical time to compute locations of celestial bodies with high precision.

      • By cortesoft 2025-07-263:02

        No libraries handle this, though

    • By d_tr 2025-07-267:39

      In a scenario where a programmer has to do this for work and might naively think that date handling is simple, the title is invaluable advice. It is one of those things that can cause real trouble.

      OTOH writing, e.g., your own renderer could cause some funny display at worst and maybe some unnecessary effort.

    • By rgavuliak 2025-07-2811:19

      > Nobody wants people who can do easy things, people want people who can do hard things.

      No, people want people that can provide value regardless of the difficulty. What you're describing is how we end up with not invented here syndrome.

    • By DonHopkins 2025-07-2620:16

      It's so tempting to tell you "never implement your own html parser using regular expressions" just to make you do it.

      I triple dog dare you!

      https://www.youtube.com/watch?v=mc6pk2FRhbA

    • By david-gpu 2025-07-2521:24

      Software companies make money by providing value to their customers via the software they provide. How does reimplementing a hard but already well-solved problem align with their goals? How does that compare with solving a hard problem for which there are no good solutions yet?

    • By geocar 2025-07-265:27

      Yes. Do it.

      The only way you understand X is by making your own X and trying to support it for a few decades, and our industry needs more people who understand X; fewer who just ask chatgpt/stackoverflow/google for "the answer".

    • By junon 2025-07-270:49

      Writing an OS. I've learned more about computers, hardware, CPU design, compilers, etc. that have translated into literally every other facet of my IT world than I could have done without this project.

      Definitely agree.

    • By drewcoo 2025-07-2621:13

      There's hard and then there's "there are so many unexpected edge cases you'll surely be cut if you touch that code," which not fun-hard.

      This is the latter.

    • By cookiengineer 2025-07-268:021 reply

      I feel obligated to comment on this.

      Due to my work I rely on web scraped data for cybersecurity incidents. For Amazon Linux, they are disclosed with the fvcked up US datetime format (Pacific Time) and not in ISO8601 formatted strings which could imply Juliet/Local time.

      In 2007 there was a new law that changed when Pacific Time enters/leaves Daylight Saving Time. Instead of making this fixed by a specific Day of a specific Month in numbered form like say "YYYY-03-01 to YYYY-10-01", they literally wrote the law quoting "first Sunday of April" to "last Sunday in October". Before 2007 it was "Second Sunday in March" to "first Sunday in November".

      I'm not making this shit up, go ahead and read the law, come back and realize it's even more complex for other timezones, because some nations seem to make fun of this by going to +14:00 hours and -11:30 hours depending on the president's mood on Christmas or something.

      In order to find out the Day of a specific calendar date, there's this cool article about Determination of the day of the week [1] which is quite insane on its own already. There is no failsafe algorithm to do that, each method of determining the day of the week has its own tradeoffs (and computational complexity that is implied).

      Then you need to get all Sundays of a month, count the right one depending on the year, map back the date to ISO8601 and then you know whether or not this was daylight saving time they're talking about. Also make sure you use the correct local time to shift the time, because that changed too in the law (from 02:00LST to 03:00LDT and 02:00 LDT to 01:00LST before, to 02:00LST to 03:00LDT and 02:00LDT to 01:00LST after the changes).

      Took me over 4 fvcking weeks to implement this in Go (due to lack of parsers), and I hate Amazon for this to this date.

      PS: Write your own Datetime parser, this will help you realize how psychotic the human species is when it comes to "standards". After all this I'm in huge favor of the Moon Phase based International Fixed Calendar [2]

      [1] https://en.wikipedia.org/wiki/Determination_of_the_day_of_th...

      [2] https://en.wikipedia.org/wiki/International_Fixed_Calendar

      • By GoblinSlayer 2025-07-2614:111 reply

        Reporting of cybersecurity incidents are easily late by a month or more, time zones are well below the rounding error. You will be more accurate to display it as YYYY±6month.

        • By cookiengineer 2025-07-274:08

          You seem to be not aware that there are a lot of legal obligations which come with providing this kind of inaccurate data. Especially if things go wrong because of it.

    • By djfivyvusn 2025-07-260:38

      Yea, date time parsing is probably fine so is rolling your own auth, unicode, font rendering, compilers.

      Datetime libs themselves? No thanks.

    • By kyawzazaw 2025-07-268:12

      Corporations and government certainly want people who can execute things that are easy, but reliably and consistently

    • By ainiriand 2025-07-277:10

      Yeah but never ever roll your own encryption, or do it but never trust it.

    • By richardw 2025-07-263:16

      Never write your own multi-planetary date/time library in brainfuck.

    • By whoamii 2025-07-264:22

      … but if you plan to sell it, don’t build your own billing system!

    • By fsckboy 2025-07-2520:421 reply

      you want to do something people really think is hard? use C. it's not safe.

      all the people who say C is not safe have downvoted me for quoting them

      • By quelsolaar 2025-07-2520:591 reply

        I exclusively write in C89. I'm a member of the ISO C standard board.

        • By boothby 2025-07-2522:17

          The confluence of tinker-for-tinkerings'-sake "hackers" and get-rich-quick "hackers" on this site certainly leads to a lot of fun miscommunication.

    • By bobsmooth 2025-07-2520:522 reply

      Solve new hard things instead of solved hard things.

      • By GoblinSlayer 2025-07-2614:19

        Most solutions are garbage though, because they evolved accidentally.

      • By dafelst 2025-07-2523:36

        Or you know, just do what you want

  • By davidw 2025-07-2518:293 reply

    It's like that joke someone posted on Twitter: "I was in favor of space exploration until I realized what it would mean for date/time libraries"

    • By 3cats-in-a-coat 2025-07-2519:016 reply

      Every time someone mentioned "days" or "months" or "years" in Andor I had to mentally zap my brain not to think about how it doesn't make a sense across a galaxy.

      • By jerf 2025-07-2519:224 reply

        Consider it a translation convention. There's a time and a place for "cycles" or "rels" or whatever, but it gets into "Calling a Rabbit a 'Smeerp'" [1] territory pretty quickly. The payoff isn't really all that great.

        Stargate SG-1 is one of my favorite instances of this. The first couple of episodes address the fact that the Earth characters do not speak the same languages as everyone else in the galaxy. Then, having established the point that A: the show runners understand this is an issue and B: it makes for a rather tedious watch, they moved on to "everyone speaks English" and we all breathed a sigh of relief. I just think of it as part of the "camera" now. It turns out that we don't necessarily want a truly literal recording of what such things would look like.

        [1]: https://tvtropes.org/pmwiki/pmwiki.php/Main/CallARabbitASmee...

        • By jgauth 2025-07-2521:273 reply

          "The Hunt for Red October" had an interesting way of handling this with the Russian speakers. The movie starts with them speaking Russian with English subtitles, does a slow zoom into the Russian-speaker's lips, and switches to English mid-sentence.

          • By jkingsman 2025-07-260:382 reply

            With some elegance, too; iirc they pivot languages on the word "Golgotha" as he reads from the bible, the Latin word for a location near Jerusalem, but having a non-English/non-Russian word be when they switch made it a lot less jarring. Plus, having it be during a read-out-loud-from-book portion allowed for more measured cadence that smoothed the switch but probably would have felt jarring if the audience were parsing multi-character dialogue when it happened.

            • By nwallin 2025-07-265:591 reply

              > they pivot languages on the word "Golgotha"

              "Armageddon" actually. Poignant because it's a movie about a nuclear ballistic submarine. But not a particularly non-English word.

              • By jkingsman 2025-08-0619:32

                ahhh I misremembered — an even better choice!

            • By 1718627440 2025-07-287:401 reply

              > "Golgotha", the latin word

              Isn't it Hebrew? (for example see John 19,17)

              • By defrost 2025-07-287:54

                From what I have to hand ..

                It appeared in the Latin Vulgate (an early predominately Latin version of the Bible), the Oxford English Dictionary has it as an Aramaic form of the Hebrew "gulgōleþ" (copied from the dictionary) or skull like hill.

          • By stevage 2025-07-2611:431 reply

            I found that incredibly clunky when I saw it. Also, it's a little bit extra jarring that Sean Connery goes from speaking Russian to speaking English with a Scottish accent.

            • By 3cats-in-a-coat 2025-07-295:23

              That's just how the Babel Fish works. It translates perfectly, but it tacks on a random accent.

          • By sms95 2025-07-2613:591 reply

            That trick has been used in movies before that too. "Judgment at Nuremberg" does something similar. A character is speaking German, slow zoom, then a switch to English.

        • By tetha 2025-07-2519:571 reply

          I think that these fundamental things can be turned into an interesting topic, but you have to try for it.

          Like, in a story background I'm pushing around, there's a coalition of a large amount of species developed on different planets. And you're a military officer, and you need to coordinate shifts, but - assuming some collectively normalized number of hours - some of your tiny dudes are tuned to 3 hours of sleep, 3 hours of leisure and 3 hours of work, others weird dudes with 2 arms and 2 legs are tuned to 38 hour cycles, and some huge dudes with a trunk in their face are tuned to 356 hour cycles.

          Even if you could train and adjust this by an hour or two (which, for the 3 hour dudes would compare to an 8 earth-hour extension of duty for us), how the heck would you coordinate any kind of shifts across this? Or does every species have their own schedule? Good look finding crossover meetings then. Some of the small guys would have to do overtime for longer meetings even.

          But you have to make it a point of the story and the challenges if you want to include it. If it is just a weird side note, just say that they figured out a conversion and that's it.

          • By jerf 2025-07-271:01

            Some Star Trek books took the opportunity to work multiple species into the Enterprise's roster, when you don't have special effects problems with doing so.

            But some others took the approach that Starfleet has a lot of vessels, and they're still somewhat segregated by species just because of those issues, and while the TV series don't corroborate that very well, I think it's better fanon overall. Peace and harmony among the species is great and all but trying to work 17 hour shifts in 2.5 Gs is going to get really old for the humans. And who wants to wear complicated breathing apparatuses for years at a time?

            It would be an interesting direction to take a book series in... why do we see so much about the Klingons and Cardassians and Vulcans on TV? It's not because they're the only important species, it's because they're the species that breath our atmosphere at more-or-less our gravity and solar cycles. The Federation could be a whole bunch of parallel Federations-within-a-Federation where there's an entire set of species who also crew with each other but breath methane, need .7G, and work around 14-hour day/night cycles, and they just don't interact much with each other, not because they hate each other but just because it's so tedious to have prolonged contact.

        • By ceejayoz 2025-07-2520:051 reply

          > The payoff isn't really all that great.

          If you’ve read David Weber’s Safehold series, this point gets super clear. It's written with names like "Zherald Ahdymsyn" (Gerald Adamson), but that makes it quite the slog for many.

          • By skrebbel 2025-07-268:321 reply

            I could not get through Banks’ “Feersum Endjinn” for this sole reason. English isn't my first language, though I’m fluent in it and read lots of hard sci-fi in it. But half a book using English “spelling rules” applied haphazardly just to make a minor point about one character was well beyond my capacity. I quoted “spelling rules” on purpose because let’s be honest, English doesn’t really have any.

            You couldn’t translate that novel to Italian or Finnish, or any language with proper phonetical spelling.

            • By UltraSane 2025-07-2611:21

              As a native speaker I found it pretty easy to read.

        • By commandlinefan 2025-07-2521:40

          Like in Game of Thrones when Davos was trying to learn to read and incorrectly pronounced the word "knight" the way it was spelled - somehow I could accept that everybody in a fictional universe spoke English except for all the ones who spoke other fictional languages, but I drew the line at words being spelled the same as well.

      • By clem 2025-07-2519:272 reply

        Vernor Vinge had it figured out in A Deepness in the Sky with the use of kiloseconds, megaseconds, and gigaseconds.

        • By greggyb 2025-07-268:05

          Coming from an educational background of imperial units, I sometimes catch flak from ... most of the world about this.

          I take joy in exuberantly pushing back on their insistence of clinging to such archaic time units as "minutes", "hours", and "days", telling them to come back when they embrace kiloseconds. It is telling that most of my friends accept this with equal joy and laughter (:

          It probably doesn't hurt that I've also spent time drilling metric conversions so that I can code-switch pretty seamlessly among units. Neurotic tendencies can have payoffs.

        • By BurningFrog 2025-07-2519:423 reply

          A second is still originally defined as 1/86400 of an Earth day.

          That doesn't make it unusable as a cross galactic time unit, and I think the same goes for years and hours.

          • By ceejayoz 2025-07-2520:033 reply

            Seconds are now (in SI) defined as calculated from behavior of cesium-133 atoms.

            https://en.wikipedia.org/wiki/Caesium_standard

            • By benlivengood 2025-07-2522:471 reply

              Unfortunately, the Second is measured for purposes of our timekeeping standards at sea-level on Earth which is ~1PPB slower than it would be in free space, as opposed to having a correction factor built into our time standards and so, for example, interplanetary ping times would be slightly shorter (in UTC/TIA nanoseconds) than expected.

              • By oneshtein 2025-07-266:281 reply

                A much more precious clock is used by USA to guide nuclear missiles without GPS. (nucleus of Thorium 229 controlled by a high-precision UV laser?)

                • By UltraSane 2025-07-2611:241 reply

                  That clock hasn't actually been built yet and it wouldn't be useful for guiding nuclear missiles.

                  https://en.wikipedia.org/wiki/Nuclear_clock

                  • By oneshtein 2025-07-2614:201 reply

                    I mean, than nucleus is much heavier and much smaller than electron, so it will be much less affected by external forces. We may see no difference between sea level and space based Thorium-229 clocks, or difference will be much smaller.

                    • By UltraSane 2025-07-2716:35

                      ICBMs can be aimed as accurately as they need to be with current inertial navigation technology.

            • By BurningFrog 2025-07-2520:141 reply

              You can also define "days" and "years" in terms of that SI definition.

              I don't think that helps with the original concern.

              • By ceejayoz 2025-07-2520:18

                You can, yes. But having it all stem from some fundamental constant value any civilization can handle permits translation between civilizations.

                "Our dates start x trillion rotations of pulsar y ago and our unit is defined as z wiggles of cesium" is a starting point.

            • By bunderbunder 2025-07-2520:171 reply

              9,192,631,770 is clearly a sensible number and not something that's blatantly chosen to match some arbitrary pre-existing geocentric standard like 10,000,000,000 would have been.

              • By ceejayoz 2025-07-2520:191 reply

                It's retrofitted to what we already defined as a second, sure.

                But you can tell an alien species our units are expressed in multiples of that, and they can translate it into how theirs works. (Vinge, for example, has space-faring humans talk about "megaseconds" and "gigaseconds" rather than days/years.)

                • By db48x 2025-07-2613:00

                  > "megaseconds" and "gigaseconds" rather than days/years.

                  More like weeks and decades. Arranging to meet someone in a megasecond is like meeting them on the weekend; a megasecond is ~11.5 Earth days. A kilosecond is short enough to be used for moment–to–moment planning. They’re about a quarter of an hour each so they’re good for scheduling work tasks, scheduling time to meet people for a meal, etc etc.

                  Gigaseconds are more rarely used, since each one is ~32 Earth years.

                  Diaspora by Greg Egan has some fun with this too. The main character is a software emulation; called a citizen rather than a flesher. Most emulations live at a subjective rate 800× faster than the flesher normal. The second chapter is three flesher days after the first but 256 megatau, or ~8 years, have passed for the main characters. The fourth chapter is two thirds of a teratau later, over 20k subjective years. For the fleshers of Earth a mere 21 years have passed. The main character has actually forgotten the events of the third chapter; one of his friends brings it up and he has to search his archived memories to figure out what his friend is talking about.

          • By gleenn 2025-07-2519:491 reply

            Case-in-point, you are mistaken. The duration of a day changes due to many things, both logically and also physically due to the nature of Earth. Also just because you can call a second a second doesn't mean that is helpful making datetime software usable or easy on a different planet.

            • By mikepurvis 2025-07-2519:591 reply

              I think he's speaking historically. Obviously now a second is a fundamental SI unit defined in terms of physics experiments, but the origin of it was as the amount of time that was 1/3600th of an hour of which there are 24 in the day.

              • By shadowgovt 2025-07-2520:26

                Similar to how almost-pi-squared meters-per-second shows up in the constant for gravitational acceleration near Earth's surface because the meter was originally "the length of pendulum that ticks once a second" and there's a pi in the pendulum motion equation.

                (... it's not exactly pi-squared because the French yanked it around a bit before settling into the modern number based on light in a vacuum and cesium atoms).

          • By layer8 2025-07-2519:563 reply

            The issue is that planetary locales will each have their own days and years (and possibly hours), so it would be confusing to adopt that same nomenclature for an interplanetary/interstellar time unit. And since the latter will be inconsistent with local time systems anyway, it’s easier to just have it use powers of ten. At least until we meet aliens that may prefer a different base.

            • By GoblinSlayer 2025-07-2615:07

              But this makes no sense, humans can't just change their circadian rhythm to match an arbitrary daylight cycle, and clocks aren't necessarily reconfigurable. And with a good enough artificial lighting you don't need to depend on star. Daylight is just weather, it has nothing to do with how calendar works.

            • By BurningFrog 2025-07-266:12

              I was 100% thinking of use by humans living on other worlds. Pretty sure Mars will use seconds and hours. Handling dates will awkward whatever they decide on.

              Currently, a Mars days is called "sol", FWIW.

              If we find other species out there I won't speculate on how they think about time.

      • By scbrg 2025-07-266:25

        https://starwars.fandom.com/wiki/Galactic_Standard_Calendar#...

        The Galactic Standard Calendar or Galactic Standard Time was the standard measurement of time in the galaxy. It was based on the Coruscant solar cycle. The Coruscant solar cycle was 368 days long with a day consisting of 24 standard hours.

        60 standard minutes = 1 standard hour

        24 standard hours = 1 standard day

        5 standard days = 1 standard week

        7 standard weeks = 1 standard month

        10 standard months + 3 festival weeks + 3 holidays = 368 standard days = 1 standard year

      • By Terr_ 2025-07-2522:34

        That makes me think of the foreword Isaac Asimov wrote for Nightfall, explaining his choice of terms:

        > The essence of this story doesn't lie in the quantity of bizarre terms we might have invented; it lies, rather, in the reaction of a group of people somewhat like ourselves, living on a world that is somewhat like ours in all but one highly significant detail, as they react to a challenging situation that is completely different from anything the people of Earth have ever had to deal with. Under the circumstances, it seemed to us better to tell you that someone put on his hiking boots before setting out on a seven-mile walk than to clutter the book with quonglishes, vorks, and gleebishes.

      • By dizhn 2025-07-2520:03

        Babylon 5 times.

        https://babylon5.fandom.com/wiki/Measurements_of_Time

        Aliens use phrases like " 2 of your Earth days "

      • By mystifyingpoi 2025-07-265:41

        Well, in entirety of SW (or at least in mainline movies) it is kinda strange, that day and night happens basically on the same 24h period as on our Earth, given that all the planets are different. Could make a much more interesting story without this crutch for the audience.

    • By TheJoeMan 2025-07-2518:456 reply

      It's funny to reason why we must go to bed when the clock has a certain number, since modern technology could easily be programmed to adjust as needed. No technical reasons the Martians can't go to bed at 9:00am today and 9:40am tomorrow. This mirrors my thoughts on why farmers caring about daylight savings time is farcical, farmers I know use the timekeeping of "crack of dawn" and "sunset".

      • By dmoy 2025-07-2519:021 reply

        iirc DST was never about farmers, and always about energy usage (lighting, etc) in the evening

        Agree I've never met a farmer who cares about DST. Though also, for non-ag farmers, sometimes "crack of dawn" isn't early enough lol. Cow: "Dairy barn has electric lights, why aren't you awake at 4am tending to my needs, Human? Vacation? Lol no, stay here. Every morning. 4am."

        • By slyall 2025-07-2523:26

          DST is not about energy use. If it actually saves energy is debated and depends a lot on the local climate and air conditioning usage etc.

          What it is about is moving an extra hour of daylight from say 5:30am-6:30am (when it is only of use to farmers and a few other early risers) to say 7pm-8pm when 95% of the population is still awake.

      • By devilbunny 2025-07-2519:081 reply

        Farmers who have to buy things (and that's almost all of them) care about the hours the shops are open, which is affected by DST.

        • By bluGill 2025-07-2519:22

          And farmers are annoyed that one day the shop is open just after dawn, and the next not for another hour. Farmers are building their life around sunrise/sunset (or sometimes the dew cycles which is tied to the sun), and then fit the rest of the world in between.

      • By Arainach 2025-07-2519:011 reply

        People want to understand when things are open/reasonable without having to do a lookup every time. A conversion has to happen somewhere - either I can say "X is in timezone foo. It's 1300 there so they're awake and I can call them" or "It's 1900 UTC, X is awake from....err....2200 to 1400, so I can call now".

        The first is significantly easier as it requires remembering only a single offset and then going with societal conventions.

        • By msla 2025-07-2621:33

          > "It's 1900 UTC, X is awake from....err....2200 to 1400, so I can call now"

          Assuming it's that simple of course. Like, you can do mental math about what UTC "officially means" for someone many miles away, but people coordinate with others even if it means their local schedule is not aligned with that ideal case. Time zones account for this by being wider or narrower than their Platonic 15° of longitude ideal in some places.

      • By johnnyanmac 2025-07-2520:13

        We're mostly still a diurnal species. We go to bed at 9PM instead of 9Am for evolutionary reasons. We can fight against it, but the reasons are as arbitrary as biology is.

        Likewise Daylight savings is a concept that had its uses, but makes less sense as technology progresses. I don't think even farmers care much about 7AM approximating to sunrise and 6PM as sunset.

      • By jameshart 2025-07-2520:15

        Time zones are less about having uniform names for the times for waking up or going to work or mealtimes, and more about when your calendar changes from one date to the next.

      • By 1718627440 2025-07-287:52

        It's a problem, because farmers have contracts with others and need them to do things at 3am one day and 4am on another.

    • By amelius 2025-07-2520:06

      Well, that problem exists now too, but everybody sticks their head in the sand.

  • By QuadmasterXLII 2025-07-2518:109 reply

    I ran into date heck recently in a medical setting for storing birthdates. Eventually I settled on the idea that a birthdate isn’t a physical time, it’s just a string. We can force the user to enter it in the format 02/18/1993 leading zeroes and all, and operations on it other than string equality are invalid. We’ll see if this survives contact with the enemy but it’s already going better than storing and reasoning about it as a point or interval in time and people’s birthdays changing when they move timezones.

    • By kaoD 2025-07-2518:453 reply

      I like how Temporal[0] does this. What you were dealing with is Temporal.PlainDate[1], i.e. a date with a calendar associated but no time or timezone (might be due to being implied but also might be irrelevant, like in birthdates).

      Temporal has other cool types, each with distinct semantics:

      - Instant: a fixed point in time with no calendar or location. Think e.g. "the user logged in at X date and time" but valid across the world for any timezone or calendar system. This is what we usually use "Unix UTC timestamps" for.

      - ZonedDateTime: like an Instant but associated with a particular calendar and location. Think an Instant but rendered "real" into a calendar system and timezone so the user can see a meaningful time for them.

      - PlainDate: already discussed. Think e.g. birthdates.

      - PlainTime: think "run task every day at 6:30pm".

      - PlainDateTime: like an Instant but associated with a calendar system, but no timezone. Think e.g. what a user would insert in a datetime picker, where the timezone is implied instead of explicitly selected.

      - PlainYearMonth: think e.g. "we'll run our reports during October 2025".

      - PlainMonthDay: think e.g. "my birthday is June 13".

      - Duration: think e.g. "the task ran for 3hrs 30min".

      Also see its important concepts[2].

      [0] https://tc39.es/proposal-temporal/docs/

      [1] https://tc39.es/proposal-temporal/docs/#Temporal-PlainDate

      [2] https://tc39.es/proposal-temporal/docs/timezone.html

      • By Terr_ 2025-07-2522:37

        I hope that as time goes on software design get better about modeling things that are guesses, conjecture, etc. rather than Absolute Facts.

        As-is, we assume lots of things are facts and we just hope it's true enough to avoid problems. (Starting with the business requirements. :p )

      • By keeganpoppen 2025-07-2519:321 reply

        yeah, it was a long (and painful) time coming, but i think the temporal api finally basically nailed it. you know a library is good when you learn something about how to think about the problem just from how the code/api is structured.

        • By benreesman 2025-07-2520:07

          Relatedly, std::chrono isnt exactly a beauty, but it did get people thinking about time points and durations and clocks and which operations are valid ways to move among them. Stuff like this is good.

      • By geocar 2025-07-266:091 reply

        > a date with a calendar associated but no time or timezone (might be due to being implied but also might be irrelevant, like in birthdates).

        It might also be relevant: Ever ask an older Korean person their age?

        > Instant: a fixed point in time with no calendar or location. Think e.g. "the user logged in at X date and time" but valid across the world for any timezone or calendar system. This is what we usually use "Unix UTC timestamps" for.

        This is not a thing. Those are intervals to some Epoch, maybe taking into account leap-seconds and maybe not. They are not very useful except grossly over long ranges.

        > - ZonedDateTime: like an Instant but associated with a particular calendar and location. Think an Instant but rendered "real" into a calendar system and timezone so the user can see a meaningful time for them.

        Like when a user logged in at X date and time. They don't do this from no location, but from some location.

        > - PlainDate: already discussed. Think e.g. birthdates.

        And already wrong.

        > - PlainTime: think "run task every day at 6:30pm".

        Erm no. You can say 18:30 hours after midnight, or you can say when the calendar says 6:30pm, but these are different things. Imagine the poor fool who wants to run the task every day at "1:30am" and has it run twice on some days.

        Bars close in some parts of the world at 30h (30時) to mean 6am the following day.

        > - PlainDateTime: like an Instant but associated with a calendar system, but no timezone. Think e.g. what a user would insert in a datetime picker, where the timezone is implied instead of explicitly selected.

        No, like a string.

        > - PlainYearMonth: think e.g. "we'll run our reports during October 2025".

        Nonsense. Also a string.

        > - PlainMonthDay: think e.g. "my birthday is June 13".

        Your birthday might be on the 29th of January. You cannot do reasonable arithmetic with such things, so it might as well be a string like many of these others.

        > I like how Temporal[0] does this.

        I don't if you can't tell. This stuff is complicated and I'd like more people exploring it because I don't know The Right Answer™ either, but I know enough to know that every existing solution is wrong in some way that can cause real harm.

        • By kaoD 2025-07-2619:221 reply

          Just FYI you were downvoted with no explanation because you missed the point in all of these and you're using a smug and off-putting tone which makes it look like only care about "being right" and not finding what "is right".

          Also you obviously didn't bother reading the "important concepts" link ([3]).

          I was going to assume good faith and reply to each of your comments but it'd probably be a waste of time. As a summary: most of your concerns are wrong due to (1) confusing "timezones" with "location" or "internationalization" (2) confusing internal representations (like Epochs) with what these objects represent as described in the "important concepts" link and (3) just being completely wrong like saying you cannot do reasonable arithmetic with PlainMonthDay or even understand that not every relevant operation is arithmetic (good luck calling `.toPlainDate(2025)` with your string representation).

          • By geocar 2025-07-276:201 reply

            > FYI you were downvoted with no explanation because you missed the point in all of these

            I think people downvote things they disagree with, and I'm not surprised people who think handling dates and times is beyond them are mad at someone exists who doesn't, because I'm calling out their impotence in a way.

            And I understand you don't want to feel impotent, so telling me that you're not going to respond to me is a way for you to reclaim some of that.

            > just being completely wrong like saying you cannot do reasonable arithmetic with PlainMonthDay

            Then prove it: How exactly do you think you can meaningfully add two PlainMonthDays? What does such a thing mean?

            I think you don't know what you are talking about, and you somehow think that means I don't either.

            • By kaoD 2025-07-2710:081 reply

              > Then prove it: How exactly do you think you can meaningfully add two PlainMonthDays? What does such a thing mean?

              Star Wars day is May the 4th. Today is May the 1st. Star Wars day is in 3 days.

              I'll stop here.

              • By geocar 2025-07-2713:331 reply

                You might want to look in a dictionary and see what `add` means.

                4May+1May is still not meaningful to me, and frankly I do not believe that it is meaningful to you. I do not think you have thought about what I am saying at all, and think it's shocking that you have an opinion about something you clearly don't understand.

                • By pavo-etc 2025-07-281:161 reply

                  You might want to look in a dictionary and see what `subtract` means.

                  4May-1May is meaningful to me, and frankly I do believe that it is meaningful to you. I do not think you have thought about what we are saying at all, and think it's shocking that you have an opinion about something you clearly don't understand.

                  • By geocar 2025-07-286:18

                    > 4May-1May is meaningful to me

                    Great, but it isn't addition.

                    > and frankly I do believe that it is meaningful to you.

                    Well you're wrong.

                    Consider 1Mar-28Feb: Should this be 1 or 2?

                    This proves it can't be subtraction (in the arithmetic sense) either.

                    > You might want to look in a dictionary and see what `subtract` means.

                    Subtraction is only addition if 4May-1May is equivalent to 4May+-1May which leaves you with an additional problem: What to do about negative plaindates.

                    > I do not think you have thought about what we are saying at all

                    I've probably thought about it too much at this point. You don't even know how arithmetic works, so I think if you have anything to say it will be too difficult for me to understand.

    • By 8organicbits 2025-07-2518:244 reply

      > in the format 02/18/1993

      Is this DD/MM/YYYY or MM/DD/YYYY? I can tell from the 18 that it's the latter, but that convention isn't universal. I'd recommend YYYY/MM/DD as a less ambiguous format, but I don't have a perfect answer.

      • By kriops 2025-07-2518:341 reply

        Furthermore, require dashes over slashes to signal that you are expecting ISO-8601 compatible dates, i.e., YYYY-MM-DD. Most users does not know the standard even exists, but it serves as an affordance that it is different from dd/mm/yyyy, etc.

        • By PaulHoule 2025-07-2518:351 reply

          Those ISO-8601 dates are great for date processing with primitive tools such as GNU sort or awk since they sort lexically, at least if you're not comparing dates in different time zones.

          • By titzer 2025-07-2518:443 reply

            ISO 8601 is the way.

            • By homebrewer 2025-07-2518:581 reply

              • By bobmcnamara 2025-07-2519:32

                Out blasphemous temporal demon! Out!

            • By tshaddox 2025-07-2520:06

              Yes, except for all the completely unhinged stuff in ISO 8601. You probably do not want to deal with durations, or repeating intervals, or even week dates and ordinal dates.

            • By cyanydeez 2025-07-2518:531 reply

              alas, the user doesnt know the way...

              • By PaulHoule 2025-07-2519:07

                That part is easy. Use a date picker of some kind

                https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/...

                or a text field with some code that converts vernacular dates to a structured format. I don't think users are going to be too weirded out at seeing "1997-04-15" and will probably learn to use that natively.

                The hard part is that a lot of devs aren't aware that there's a standard and that standard is superior to the alternatives.

      • By senfiaj 2025-07-2518:382 reply

        Every time I see an input date string in XX/XX/YYYY format I get a micro PTSD flashback. This cannot be parsed reliably and is locale dependent. The standard date format is YYYY-MM-DD (it's also the date part of the ISO time format). Raw text inputs should be avoided as much as possible, date/time pickers should be preferred.

        • By hanche 2025-07-2518:561 reply

          Even worse with just two digits for the year! 01/02/03 could be 1 Feb 2003, or 2 Jan 2003, or 3 Feb 2001. Let’s just be thankful no one ever uses any of remaining three permutations.

          • By oneshtein 2025-07-266:071 reply

              $ LANG=C date --date="01/02/03"
              Thu Jan  2 00:00:00 EET 2003
            
              $ LANG=de_AT.utf8 date --date="01/02/03"
              Do 02 Jän 2003 00:00:00 EET
            
              $ LANG=zh_HK.utf8 date --date="01/02/03"
              2003年01月02日 星期四 00:00:00 EET

            • By 1718627440 2025-07-287:52

              That only shows that date only converts on output and not on input.

        • By dragonwriter 2025-07-2519:41

          > The standard date format is YYYY-MM-DD (it's also the date part of the ISO time format)

          Strictly, it is the extended form of the ISO 8601 calendar date format. (The basic format has no separators.)

          ISO 8601 allows any of its date formats (calendar date, week date, or ordinal date) to be combined with a time representation for a combined date/time representation, it is inaccurate both to call any of the date formats part of the time format, and to call the calendar date format the format that is part of the combined date/time format.

          (There's a reason why people who want to refer to a simple and consistent standard tend to choose RFC-3339 over ISO 8601.)

      • By happytoexplain 2025-07-2518:36

        This isn't really relevant to the parent's topic though, aside from UX. The UI can tell the user which is the day and which is the month. The logic layer knows the format explicitly.

      • By jack_pp 2025-07-2518:25

        Pretty sure they force the user into that format so that shouldn't be an issue

    • By PaulHoule 2025-07-2518:34

      I guess in your case you're never doing date arithmetic or greater than or less than, but only doing equality testing, right? That is, it's part of a composite key.

      I faced a similar problem with a form where people were supposed to submit a date and probably not aware of what timezone was involved. I figured that so long as they selected "02/28/1993" and people always saw "02/28/1993" that was correct and if they ever saw it differently it was wrong. So I used non-TZ aware dates throughout the whole system.

    • By BurningFrog 2025-07-2519:52

      Normal/"legal" dates are not timestamps or related to timezones, and this fact will eternally be rediscovered as long as humans write software.

    • By legulere 2025-07-2521:12

      If you store it just as a string it means that you cannot do anything useful with it like age-dependent logic or you just pass on parsing logic to users of the field.

      FHIR in my opinion has a pretty good system for dates (including birthdates): YYYY, YYYY-MM, or YYYY-MM-DD. (Not knowing your exact birthday is common for some countries).

      https://build.fhir.org/datatypes.html#date

    • By dragonwriter 2025-07-2519:442 reply

      What environment are you in where you have to work with birthdates, you have timezone aware dates, times, and intervals, but you don't have a naive/plain/local date type that already exists forcing you to use strings in place of date-without-timezone?

      You seem to have a reasonably expedient solution for that problem, but it is surprising to have the combination of things you have to have and things you have to be missing to have that problem in the first place.

      • By happytoexplain 2025-07-262:09

        They may have something that's just not as easy to work with as strings. E.g. in Swift, you have DateComponents, but that's too dynamic (and Date is sometimes referred to as naive, but that's a misunderstanding, since they are timestamps, not date+time).

      • By QuadmasterXLII 2025-07-2712:28

        Javascript/swift/kotlin frontend, python backend, mysql server. The problem wasn’t that I had access to zero (presumably) well implemented time abstractions with all the bells and whistles, it was that I had five well implemented native time abstractions.

    • By shadowgovt 2025-07-2520:321 reply

      IIUC why medical cares at all, this is really insightful. Because as far as I'm aware, the medical industry basically uses birthdate as a key; it helps to (a) tell two patients with other primary keys (like name or address) apart and (b) do a quick mental-acuity check on the patient by just having them regurgitate the value and doing a human-brain string= on it.

      • By 1718627440 2025-07-287:55

        The dose varies per age, but this isn't that exact.

    • By kccqzy 2025-07-2518:134 reply

      > people’s birthdays changing when they move timezones

      That's because the developers use datetimes (aka timestamps) to store a single date. Just pick an arbitrary epoch date (such as January 1, 1900 as used by Excel, or my favorite January 1, 1600 since 1600 is a multiple of 400 making leap year calculations even simpler) and store the number of days elapsed since then. The rules involving leap years are much much simpler than rules involving timezones and timezone databases. The translation from/to this representation to a broken-down y/m/d takes only ~50 lines of code anyways.

      Of course if you don't need to do arithmetic on dates, just store three numbers, year, month, and day.

      • By SoftTalker 2025-07-2518:292 reply

        No, don't do that. Use a date datatype (not date/time). You aren't the first person to ever need to handle dates without times/timezones in a computer program. Use what your database/language/libraries already have to support that.

        • By tadfisher 2025-07-2518:46

          Specifically, a "local date", codified as LocalDate in every date library worth a damn, except for Javascript which chose "PlainDate" just to be different.

        • By PaulHoule 2025-07-2518:511 reply

          Well, for hardcore chronology Julian dates are what you do.

          https://en.wikipedia.org/wiki/Julian_day

          which are the moral equivalent of Unix timestamps with a different offset and multiplier. These work OK for human history but will break if you go far enough into the past or the future because uncertainty in the earth's rotation adds up over time.

          If you don't care about timezones timezones may still care about you, if you want to minimize trouble it makes sense to properly use timezone-aware Zulu (GMT) dates for everything if you can.

          In certain cases you might be doing data analysis or building an operational database for throttling access to an API or something and you know there are 16-bits worth of days, hours, 5-minute periods or something it can make sense to work relative to your own epoch.

      • By happytoexplain 2025-07-2518:27

        In my humble opinion, this is not good advice unless you demonstrably need it for query performance or something. It is very easy for the logic layer to accidentally mess that up, either in reading or, worse, in writing back.

        In this case, I'd suggest storing what you mean (the user wasn't born 9,487 days after Jan 1 1970. They were born Dec 23, 1995.)

        Storing the literal units (and ONLY the relevant units), as the parent has, is robust and logically+semantically correct (they could add a translation layer for UX so the user doesn't have to be particular, but that's beside the point). Whether you use a string or a struct or some date-only type is moot, as long as you're literally storing the year, month, and day, and only those three things. You can ephemerally convert it to your platform's date type if you need to.

      • By pavel_lishin 2025-07-2519:361 reply

        > The translation from/to this representation to a broken-down y/m/d takes only ~50 lines of code anyways.

        Didn't the article explicitly tell us not to write our own date parsing library?

        • By kccqzy 2025-07-2520:32

          I disagree with that. And furthermore it's not parsing. It's converting between a single integer and a tuple of three integers.

      • By habibur 2025-07-2519:222 reply

        > or my favorite January 1, 1600 since 1600 is a multiple of 400

        You need to deal with 1600 and 2000 being leap year.

        While 1700, 1800, 1900 not being a leap year.

        I limit dates from 1900 to 2100. All !year%4 = leap year.

        Especially when you try to convert int_date to y,m,d things get tricky.

        • By kccqzy 2025-07-2520:321 reply

          That's exactly why I propose a multiple of 400, not a multiple of 100. The proleptic Gregorian cycle is a 400-year cycle. There are 97 leap years in it. What's tricky about it? Just take a look at my code: https://github.com/kccqzy/smartcal/blob/9cfddf7e85c2c65aa6de...

          • By oneshtein 2025-07-266:40

            Why not just make a map of dates to days since 0001-01-01 in a plain text, then compress it at build time? We are not constrained by memory anymore.

            Just use simple database as source of truth with all days passed since a start of human history (e.g. 6000 years ago) with labels such as "this day 12345678 was known as day XXXX-xx-xx in those regions, also known as YYYY-yy-yy in those regions, also known as ZZZZZ in this specific region". It's not a hard task to automatically compress such database into a compact representation.

        • By jerf 2025-07-2519:25

          "Years are not leap years, unless % 4, unless % 100, unless % 400."

          It's a wacky rule for sure.

          2000 was fun. Everyone knows about "unless % 4", but there was also an interesting and very vocal set of people who knew about the "unless % 100" but somehow knew that without knowing about the "unless % 400" part. A very specific level of knowledge.

    • By _mlbt 2025-07-2518:232 reply

      Even better, just make the user input dates using a calendar date picker widget instead of a text field. This gives you full control of the input.

      • By mattkrause 2025-07-2518:37

        I always find that a little annoying: it takes way too many clicks (esp. for a birth year) and then you've got to find the day of the week.

        I'd hate it less if typing updated the widget.

      • By Tyr42 2025-07-2518:31

        I've had to click back once per year old I am sometimes. I'd rather just type my birthday.

HackerNews