Closed BaconFist closed 1 month ago
The cause seems to be in https://github.com/werner-scholtz/kalender/blob/50043322a49ade38194ae9c477c5691bcb697294/lib/src/extensions.dart#L23-L51
I assume there is a problem with DateTime.add over daylight saving time.
Example:
I think i found the cause and a possible solution.
The cause seems to be that DateTime.add(Duration(days: i))
adds i*secondsPerDay
seconds instead of just a day.
Using DateTime(year, month, day+i)
incremets the day directly. It also works across months and years.
For example DateTime(2024,12,31+1)
will result in 2025.01.01
.
https://dartpad.dev/?id=2aa8b0fa0e3dda67af02fca9000f2344
void main() {
DateTime start = DateTime(2024,10,27);
DateTime end = DateTime(2024,11,2);
List<DateTime> dates = [];
int diff = start.difference(end).inDays.abs();
for(int i=0;i<diff;i++){
dates.add(DateTime(start.year,start.month,start.day+i));
}
print(dates.join('\n'));
}
created a pull request to solve this.
There is a duplicate of October 27. 2025. I've verified it at https://werner-scholtz.github.io/kalender/ in Month and Multi Week view.
What i have seen so far:
flutter --version
pubspec.yaml