Jiff 1.0: A datetime library for Rust
- quodlibetor - 19325 sekunder sedanI maintained chrono for about half a decade, and the specific reason I took on maintenance was because the API sucked and I hoped I could make it better.
Turns out, the reason people wanted to use it was because the API was stable and every slight step towards improvement was met with... resistance. I stopped maintaining it because the burnout from seeing what it could be and not seeing any path to get there was too much for me.
I'm extremely grateful to burntsushi for writing the datetime library rust deserves. Chrono is stable and is maintained (though semi-deprecated) by an extremely reliable rustacean -- you don't need to leave, but you'll probably be happier if you do.
- Dagonfly - 19506 sekunder sedan> When should I use Jiff? Jiff isn’t always the right thing to use.
I really appreciate when a project calmly acknowledges that it's not the right tool for every use case, and is not trying to be. That's professional engineering.
Especially in the AI-age, the crucial skill will be what NOT to implement.
- mgrandl - 23567 sekunder sedanIt’s so good like all the other burntsushi libs. Really hope it will be adopted more and more by the wider ecosystem over chrono and co.
- ddahlen - 22132 sekunder sedanThis looks interesting!
Time is such a pain, I write code for simulating orbits of asteroids/stuff in the solar system, and time and time conversions play a major roll in it. I often need accuracy at the mega-year to giga-year scales, but also sometimes micro-second relative.
I saw on this page that you at least mention TAI time, how are you handling time scales in general? Like would it be hard to add some other timescales like UT1?
Right now I have to do all of this manually and I have been using chrono as just a convenience wrapper so that my users can convert ISO time strings into my internal representation.
Edit: Oh no! I just found out chrono is being semi-deprecated, looks like I'm going to be switching...
- kccqzy - 641 sekunder sedanThe one thing I don’t like in most datetime libraries is that for timezone names they all just defer to IANA time zone database. This database is a wonderful compendium of all time zones historically in use, but it is absolutely programmer oriented and not user oriented. There are two main problems: (1) it’s location based; (2) it captures history faithfully.
The first problem is the bigger problem. If you are writing an app that asks the user for a zoned time, the user will want something like today 7pm eastern time. But EST is of course highly ambiguous and so is EDT. The correct solution is either EST5EDT or America/New_York. Neither is user friendly. The first string EST5EDT looks like gibberish to the average user. The second raises concerns in all other cities sharing the same timezone as New York. Why not have an entry for Philadelphia or Washington DC? Some even say it is inherently classist to pick the city with the biggest population, not the most important by some other metric. Is New York more deserving than our nation’s political capital? Why is Los Angeles more deserving than San Francisco, other than the fact that the maintainer of the database is physically in Los Angeles? This is an actual criticism in iOS calendar app on the now defunct Apple forums. If you want the user to pick a timezone you better make sure Eastern Time is an allowed option, and maybe also include all the cities and municipalities in the zone.
The second problem is the fact that the timezone definitions change according to the actual rules in effect in history. This is sometimes not what you want. Indeed I notice that sometimes all date libraries use the proleptic Gregorian calendar meaning our current calendar system extended backwards; no library that I know of automatically switches to Julian calendars before the cutoff. Why this inconsistency? I’d argue that when most humans express a zoned time they expect the current rules to be extended backwards. People forget the daylight saving rules change in the 2000s when talking about times before that change and expect the current rules.
Not to be a detractor here for this library, but we should aim higher.
- the__alchemist - 22412 sekunder sedanI will give this a shot, however... Rust is the only language I've used where I want to use the established one, chrono. I will roll my own in JS, for example, or begrudgingly use or wrap the python.datetime one (And not touch the third party python ones which do awful things inspired by Moment.js like conflating dates , times, and datetimes, under the guise dates and times don't have use on their own), but Chrono actually is comparatively nice (S-tier relative to others), both std and no_std.
- kjuulh - 20669 sekunder sedanJiff is very nice to work with. It is always a pleasure working with something crafted by burntsushi
- pbrowne011 - 21992 sekunder sedanNice! I appreciated the documentation for tzdb on avoiding embedding and the thought process behind using "rearguard" data [1]. Some related GitHub issues are also worth reading [2] [3].
[1] https://docs.rs/jiff-tzdb/latest/jiff_tzdb/#data-generation
- robrain - 21273 sekunder sedanPreviously on HN (pre-1.0): https://news.ycombinator.com/item?id=41031037
- fstephany - 23572 sekunder sedanJiff will probably be the default datetime library for a lot of Rustaceans (and LLMs) in the years to come.
Thank you for your work on this burntsushi!
- poulpy123 - 23128 sekunder sedanI would have expected a modern language to have an extensive datetime library in its standard library
- - 17567 sekunder sedan
- arjie - 6900 sekunder sedanMy favourite part about BurntSushi software was that the structure of the program was enough that even a novice at the language could change things. Very well laid out. I had a fork of many of his applications for personal use and it was always trivial to jump in and edit. Excellent stuff.
> Jiff is pronounced like “gif” with a soft “g,” as in “gem.”
This is classic anti-trust monopoly leveraging. Lucky I'm on this side of the debate :)
- Sparkle-san - 23398 sekunder sedan> Jiff is pronounced like “gif” with a soft “g,” as in “gem.”
Woah now, let's not get too controversial.
- dizzant - 2288 sekunder sedan> Jiff is pronounced like “gif” with a soft “g,” as in “gem.”
A masterclass in viral outrage bait. Not a Rustacean, I clicked the link exclusively for this nugget and will probably tell my Rust-loving colleagues about it tomorrow.
For the record, I like the converse better:
> Jiff is pronounced with a hard “g”, as in “gif”.
- gosen - 22013 sekunder sedanI thought it's the right moment to finally do something with Rust, but I work on my "J" pronunciation first
- NetOpWibby - 22741 sekunder sedanLove seeing the correct pronunciation of gif
- i2talics - 5764 sekunder sedanIME time is one of those things that a lot of developers try to wish away the complexity. The hard part is defining what you even mean by time, but if nobody asks the question then you don't have to provide an answer.
Strings are also similarly gnarly topic that I find a lot of devs try to ignore.
- - 17886 sekunder sedan
- brianwitte - 22936 sekunder sedanthe jiff pronunciation meta got my brain working hard for second. love it
- PowerElectronix - 21739 sekunder sedanWeird, you can't ever pronounce Jiff as gif.
- jheriko - 20624 sekunder sedan[dead]
- - 23061 sekunder sedan
Nördnytt! 🤓