-
Hi, 👋🏽 I don't think 295217 hours is 0 days. let now = Zoned::now();
let birthday = date(1990, 11, 28).intz("Asia/Jakarta").unwrap();
let age = now.since(&birthday).unwrap();
dbg!(&now);
dbg!(&age);
dbg!(&age.get_days());
dbg!(&age.get_hours()); [jiff-demo/src/main.rs:10:5] &now = 2024-08-01T17:47:21.950643217+07:00[Asia/Jakarta]
[jiff-demo/src/main.rs:11:5] &age = PT295217h47m21.950643217s
[jiff-demo/src/main.rs:12:5] &age.get_days() = 0
[jiff-demo/src/main.rs:13:5] &age.get_hours() = 295217 Am I missing something? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
-
as the line indicates, the if you're asking why the |
Beta Was this translation helpful? Give feedback.
-
@fbstj Has it right. A I saw someone else had this same exact confusion though. So I beefed up the docs on each of Is there something else that I could add to the docs that would have helped avoid this confusion? |
Beta Was this translation helpful? Give feedback.
as the line indicates, the
age
object contains only the 295217h and zero days. you might be looking for the round method to rebalance the object, or the total method to calculate only the days (including fractional parts).if you're asking why the
age
object is mostly hours, that is described in the since method documentation