Skip to content

Conversation

@jonasfj
Copy link
Member

@jonasfj jonasfj commented May 22, 2025

I'm not entirely sure why this fails when using local time, but not using local time is probably a good idea.

I suspect that if we wanted to make the logic more robust, we should convert DateTime objects to milliseconds, and do a floating point division with 24 * 60 * 60 * 1000 (ms per day), and then round to nearest count of days.

I suspect the problem with Duration.inDays is that it doesn't round up, it'll always round down.

That may be a better fix.

@jonasfj jonasfj requested a review from szakarias May 22, 2025 13:00
Copy link
Contributor

@szakarias szakarias left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jonasfj jonasfj merged commit 6fc0f20 into dart-lang:master May 23, 2025
31 checks passed
@jonasfj jonasfj deleted the fix-datetime-to-utc branch May 23, 2025 08:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants