# Comparing Javascript Temporal with Julia

**URL:** <https://discourse.julialang.org/t/comparing-javascript-temporal-with-julia/125419>\
**Category:** General Usage\
**Tags:** dates, stdlib, timezones, datetime\
**Created:** [January 31, 2025, 7:37am UTC](https://discourse.julialang.org/t/comparing-javascript-temporal-with-julia/125419 "2025-01-31T07:37:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![digital\_carver](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/digital_carver/32/33818_2.png) [@digital\_carver](https://discourse.julialang.org/u/digital_carver)\
**Post date:** [January 31, 2025, 7:37am UTC](https://discourse.julialang.org/t/comparing-javascript-temporal-with-julia/125419/1 "2025-01-31T07:37:22Z")

</div>

An article about Javascript’s upcoming [Temporal](https://developer.mozilla.org/en-US/blog/javascript-temporal-is-coming/) API for working with dates and times is trending on Hacker News today. I was curious how it compared with Julia, so I used a small Pluto notebook to test things out and write down my thoughts. The text remarks from the notebook are:

- There doesn’t seem to be a way to work with the Chinese calendar in Julia, not even with external packages. There’s a [Calendars.jl](https://github.com/PeterLuschny/Calendars.jl) from 2022, but it doesn’t have the Chinese (or Indian, or Japanese) calendar.
- The `Millisecond(::Period)` method doesn’t seem to be documented, so it wasn’t at all obvious that dividing by `Millisecond(Hour(1))` was the easy way to go from a `Millisecond` value to the number of `Hour`s in it.
  - In general, this kind of `Period` conversion is cumbersome, awkward, and error-prone in Julia.

- It’s nice that string interpolation of a period automatically does the right thing, eg. printing “XY hours” when it’s a `Hour` value. But this is hardcoded in the stdlib, so English locale is the only option.
- There isn’t a ISO 8601 (locale-independent) duration format implementation in Julia AFAICT. There’s ISO 8601 _timestamp_ format in NanoDates.jl, but not for _duration_.
- Overall, Julia already implements a large part of the planned Temporal API (either in the stdlib or in TimeZones.jl). Its biggest weaknesses compared to JS Temporal are to do with localization: locale-specific calendars, locale-specific "era"s, locale-specific string outputs.
  - But the documentation and the interface in some parts could also do with more polish for ease-of-use.

[temporal.jl](https://discourse.julialang.org/uploads/short-url/qfuqFnry3URWDWyTzCLU1lJVCUh.jl) (8.8 KB)
