You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add TryFrom for PartialDuration to Duration (#585)
This PR adds a `TryFrom` implemenation for converting a PartialDuration
to Duration.
The core reasoning is to simplify the case where someone would want to
add a single day in Rust.
```rust
use temporal_rs::{Temporal, PlainDate, partial::PartialDuration};
let today = Temporal::now().plain_date_iso(None).unwrap();
let one_day = PartialDuration::empty().with_days(1);
// Before:
// let tomorrow = today.add(Duration::from_partial_duration(one_day).unwrap()).unwrap()
// After:
let tomorrow = today.add(one_day.try_into().unwrap()).unwrap();
```
0 commit comments