Re:Never write your own date parsing library
by benlivengood on Friday July 25, 2025 @06:14PM
(#44689133)
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.
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.
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.
Re:Never write your own date parsing library
by tbrownaw on Friday July 25, 2025 @11:19PM
(#44691042)
> 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.
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.