1
- # Temporal_rs release v0.1
1
+ ---
2
+ layout : post
3
+ tags : [post]
4
+ title : " Temporal_rs v0.1 release"
5
+ description :
6
+ Powering the new date/time API in Boa, Kiesel, V8, and any Rust
7
+ projects near you!
8
+ authors : temporal-dev
9
+ ---
2
10
3
11
After almost 2+ years of development, we're pleased to announce the 0.1
4
12
release of ` temporal_rs ` . A calendar and time zone aware Rust date/time
5
- library based on ECMAScript's Temporal API.
13
+ library based on ECMAScript's [ Temporal API] [ mdn ] .
6
14
7
15
` temporal_rs ` is a highly conformant implementation of the Temporal API
8
16
in Rust that can be used in native Rust code or embedded into ECMAScript
9
- engines / interpreters to support their implementations.
17
+ engines / interpreters to support their implementations, which we first
18
+ announced in our first
19
+ [ Temporal blog post] ( ../2025-06-15-temporal-impl-1.md ) , if you're
20
+ interested in learning more about small implementation details.
10
21
11
- Currently, ` temporal_rs ` is being used by Boa, Kiesel, V8, and Yavashark
12
- for their Temporal implementations (but more on that later).
22
+ Currently, ` temporal_rs ` is being used by Boa, [ Kiesel] [ kiesel-site ] ,
23
+ [ V8] [ v8-site ] , and [ Yavashark] [ yavashark-repo ] for their Temporal
24
+ implementations (more on that later) and will soon being
25
+ [ shipping in Chrome] ( https://chromestatus.com/feature/5668291307634688 ) .
13
26
14
27
To celebrate the 0.1 release of ` temporal_rs ` , we'll cover a short
15
28
background of the Temporal implementation in Boa and why ` temporal_rs `
16
- was split into it's own crate, we'll go over the libraries general
17
- design, then we'll walk through a couple brief examples of using
18
- ` temporal_rs ` , and finally we'll talk about the FFI and engine adoption.
29
+ was split into it's own crate, we'll go over the library's general
30
+ design, and then we'll walk through a couple brief examples of using
31
+ ` temporal_rs ` before finally talking about the FFI and engine adoption.
19
32
20
33
## Some background and history
21
34
@@ -119,7 +132,8 @@ its not interesting.
119
132
120
133
The Temporal API focuses on a group of 8 date and time types, each of
121
134
which corresponds to a different aspect of date and time with varying
122
- support for ` Calendar ` s and ` TimeZone ` s.
135
+ support for calendars and time zones, which are, unsurprisingly,
136
+ represented in ` temporal_rs ` by the ` Calendar ` and ` TimeZone ` types.
123
137
124
138
| Temporal type | Category | Calendar support | Time zone support |
125
139
| -------------- | --------------------------------- | ---------------- | ----------------- |
@@ -143,6 +157,9 @@ date accessors. The exception being PlainYearMonth and PlainMonthDay
143
157
which are missing their day and year, respectively ... for all intents
144
158
and purposes.
145
159
160
+ For a full view of the API, we recommend checking our
161
+ [ documentation] ( https://docs.rs/temporal_rs/latest/temporal_rs/ ) .
162
+
146
163
## ` temporal_rs ` design overview
147
164
148
165
` temporal_rs ` in general implements large portions of the specification
@@ -239,7 +256,7 @@ features.
239
256
use temporal_rs :: Temporal ;
240
257
241
258
// Get today's date
242
- let today = Temporal :: now (). to_plain_date_iso (None ). unwrap ()
259
+ let today = Temporal :: now (). plain_date_iso (None ). unwrap ()
243
260
```
244
261
245
262
#### Date operation's available
@@ -306,21 +323,19 @@ println!("{today_coptic}");
306
323
```
307
324
308
325
While we can extend these examples further, a more fun exercise for the
309
- reader would be taking a look at the
310
- [ Temporal cookbook] ( https://tc39.es/proposal-temporal/docs/cookbook.html )
311
- as it displays the utility of the Temporal API using JavaScript and all
312
- of these examples are now usable from Rust as well.
326
+ reader would be taking a look at the [ Temporal cookbook] [ cookbook ] as it
327
+ displays the utility of the Temporal API using JavaScript and all of
328
+ these examples are now usable from Rust as well.
313
329
314
330
## FFI and engine adoption
315
331
316
332
As previously stated, ` temporal_rs ` is used in Boa, Kiesel, and V8.
317
333
There's just one thing, the latter of the two are ECMAScript
318
334
implementations written in Zig and C++, respectively, not Rust. This was
319
- made possible through ` temporal_rs ` 's sister crate ` temporal_capi ` , a
320
- FFI library that provides C and C++ bindings to ` temporal_rs ` .
335
+ made possible through ` temporal_rs ` 's FFI crate ` temporal_capi ` , which
336
+ provides C and C++ bindings to ` temporal_rs ` .
321
337
322
- The bindings are autogenerated via
323
- [ Diplomat] ( https://github.com/rust-diplomat/diplomat ) , which is a
338
+ The bindings are autogenerated via [ Diplomat] [ diplomat-repo ] , which is a
324
339
project for generating FFI definitions for Rust libraries. In general,
325
340
it's a really cool project and would definitely recommend checking it
326
341
out if you're looking to generate FFI bindings for other languages for
@@ -329,10 +344,10 @@ your Rust library.
329
344
There is some added benefits to offering C and C++ bindings beyond the
330
345
classic: oh, let's (re)write it in Rust.
331
346
332
- First, this allows other languages and engines to benefit from Rust's
333
- type system and memory safety guarantees without having to rewrite
334
- everything in Rust. It's a more modular and incremental approach that
335
- provides some level of flexibility.
347
+ First, this approach allows other languages and engines to benefit from
348
+ Rust's type system and memory safety guarantees without having to
349
+ rewrite everything in Rust. It's a more modular and incremental approach
350
+ that provides some level of flexibility.
336
351
337
352
Secondly, with how large the API is, ` temporal_rs ` streamlines the
338
353
ability to adopt the Temporal API for any current and future
@@ -341,45 +356,61 @@ be done primarily in one place and then released downstream. While it's
341
356
easy to say: "just use our library" to promote adoption. Seriously, just
342
357
use the library. The Temporal API is massive from an implementation
343
358
perspective and the glue code plus ` temporal_rs ` is relatively trivial
344
- in comparison to a fresh implementation.
359
+ in comparison to a fresh, from scratch implementation.
345
360
346
361
Third, with adoption from multiple engines, ` temporal_rs ` benefits via
347
- further test coverage beyond the native unit tests. For instance, of the
348
- engines that offer conformance numbers (Boa, Kiesel, and V8), all of
349
- them are currently north of 95% conformance with V8 reaching the highest
350
- at around 99% conformance. The conformance difference between the
351
- engines being due to the current implementation state of other features,
352
- i.e. Boa still hasn't completed its ` Intl.DateTimeFormat ` implementation
353
- yet so it fails all ECMA402 ` toLocaleString ` tests. As a result though,
354
- we can be fairly confident in the general correctness of ` temporal_rs ` ,
355
- and any potential bugs will ideally be found and addressed fairly
356
- quickly.
362
+ further test coverage beyond the native Rust unit tests. For instance,
363
+ of the engines that offer conformance numbers (Boa, Kiesel, and V8), all
364
+ of them are currently north of 95% conformance with V8 reaching the
365
+ highest at around 99% conformance. The conformance difference between
366
+ the engines being due to the current implementation state of other
367
+ features, i.e. Boa still hasn't completed its ` Intl.DateTimeFormat `
368
+ implementation yet so it fails all ECMA402 ` toLocaleString ` tests. As a
369
+ result though, we can be fairly confident in the general correctness of
370
+ ` temporal_rs ` , and any potential bugs will ideally be found and
371
+ addressed fairly quickly.
357
372
358
373
In general, ` temporal_rs ` is a pretty good test case with reference code
359
- for setting up a Rust library over FFI with usage in a C++ and Zig
360
- codebase, so that's really cool .
374
+ for setting up a Rust library over FFI with usage in both a C++ and Zig
375
+ codebase.
361
376
362
377
## Conclusion
363
378
364
- The 0.1 release of ` temporal_rs ` is out. We expected the general API to
379
+ The 0.1 release of ` temporal_rs ` is out. We expect the general API to
365
380
remain fairly stable moving forward, with any non-patch bumps being for
366
381
added features. Feel free to try it out, and provide feedback / file any
367
- issues you come across.
382
+ issues you come across. Although, we will make changes and semantic
383
+ versioning bumps based on feedback or the Temporal specification.
384
+
385
+ Our current plan is that we hope have any remaining issues addressed and
386
+ the API fully stable for when Temporal is accepted by tc39 and moved to
387
+ stage 4. Once Temporal is stage 4, we will move forward with a 1.0
388
+ release.
368
389
369
390
` temporal_rs ` started as an interesting experiment in creating an engine
370
391
agnostic library of the Temporal API that could also be usable as a
371
392
date/time library in native Rust code. We've seen pretty successful
372
393
results from other engines adopting the library for use. And with any
373
- luck, it will also be useful for the Rust ecosystem as a whole.
394
+ luck, we hope this library will also be useful for the Rust ecosystem as
395
+ a whole as well.
374
396
375
397
## Special thanks
376
398
377
- We'd like to thank all the contributors to ` temporal_rs ` for helping it
378
- get to 0 .1.
399
+ We'd like to thank all the [ contributors] to ` temporal_rs ` for helping
400
+ it get to v0 .1.
379
401
380
402
Thanks to the University of Bergen students who helped drive some of the
381
403
major conformance push earlier this year.
382
404
383
405
Also, a huge thanks to all the Temporal champions for all their work on
384
406
the specification as well as the ICU4X project for their incredible
385
407
ongoing work on calendars and all things i18n datetime related.
408
+
409
+ [ mdn] :
410
+ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal
411
+ [ v8-site ] : https://v8.dev/
412
+ [ kiesel-site ] : https://kiesel.dev/
413
+ [ yavashark-repo ] : https://github.com/Sharktheone/yavashark
414
+ [ cookbook ] : https://tc39.es/proposal-temporal/docs/cookbook.html
415
+ [ diplomat-repo ] : https://github.com/rust-diplomat/diplomat
416
+ [ contributors ] : https://github.com/boa-dev/temporal/graphs/contributors
0 commit comments