Skip to content
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

🐛 Wrong number of days for a month in DatePicker #1049

Closed
matthiasnunn opened this issue Apr 1, 2024 · 0 comments
Closed

🐛 Wrong number of days for a month in DatePicker #1049

matthiasnunn opened this issue Apr 1, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@matthiasnunn
Copy link

Describe the bug
March 2024 has only 30 days instead of 31 days in DatePicker.

To Reproduce
See the demo page:
Bildschirmfoto 2024-04-01 um 13 01 27

Additional context
The problem occurs in the method _getDaysInMonth in the file date_picker.dart:

return DateTimeRange(
  start: DateTime(year, month),
  end: DateTime(year, month + 1),
).duration.inDays;

Reproducing it for March 2024 it returns 30:

return DateTimeRange(
  start: DateTime(2024, 3),
  end: DateTime(2024, 3 + 1),
).duration.inDays;

But using DateTime.utc returns correctly 31:

return DateTimeRange(
  start: DateTime.utc(2024, 3),
  end: DateTime.utc(2024, 3 + 1),
).duration.inDays;
@bdlukaa bdlukaa added the bug Something isn't working label Apr 1, 2024
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants