Skip to content

DateTime. Bug with winter/summer time #51963

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Aqitaniya opened this issue Apr 5, 2023 · 2 comments
Closed

DateTime. Bug with winter/summer time #51963

Aqitaniya opened this issue Apr 5, 2023 · 2 comments
Labels
closed-as-intended Closed as the reported issue is expected behavior

Comments

@Aqitaniya
Copy link

Aqitaniya commented Apr 5, 2023

This tracker is for issues related to:

  • Dart core libraries: DateTime

  • Dart SDK version: 2.19.6 (stable) (Tue Mar 28 13:41:04 2023 +0000) on "macos_arm64"

Example:

  final DateTime date = DateTime(2023, 03, 27);
  print(date);  // 2023-03-27 00:00:00.000
  print(date.subtract(const Duration(days: 1)));  //2023-03-25 23:00:00.000
  print(date.subtract(const Duration(hours: 24)));  //2023-03-25 23:00:00.000

The same issue with date.add and others

@julemand101
Copy link
Contributor

Works as intended if you read the documentation.

Duplicate of #37449

@lrhn
Copy link
Member

lrhn commented Apr 5, 2023

Correct. The difference between two local-time DateTime objects is the actual time between the two, and adding Durations to DateTime objects gives the local time after that duration has passed.
Duration doesn't actually understand "days", it just thinks converts them to 24 hours.

@lrhn lrhn closed this as completed Apr 5, 2023
@lrhn lrhn added the closed-as-intended Closed as the reported issue is expected behavior label Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed-as-intended Closed as the reported issue is expected behavior
Projects
None yet
Development

No branches or pull requests

3 participants