flutter_calendar_view icon indicating copy to clipboard operation
flutter_calendar_view copied to clipboard

DayView shows today's event tomorrow

Open szysl opened this issue 2 years ago • 6 comments

Steps to reproduce: Open https://simformsolutionspvtltd.github.io/flutter_calendar_view/#/ Review MonthView - there are two event planned for today Switch to DayView - no events today

You can also add an event with date - today and you will see it tommorrow, not today.

szysl avatar Aug 24 '22 09:08 szysl

I guess the wrong _currentIdex calculation is due to DateTime.difference and Duration.inDays() disalignment when considering Daylight Saving Time, as also stated in DateTime.difference() documentation.

To fix this we have to compare dates in utc, e.g.:

/// Gets difference of days between [date] and calling object.
int getDayDifference(DateTime date) => 
    DateTime.utc(year, month, day).difference(DateTime.utc(date.year, date.month, date.day)).inDays.abs();

Have a look at PR #104

francescovgg avatar Sep 06 '22 08:09 francescovgg

I guess the wrong _currentIdex calculation is due to DateTime.difference and Duration.inDays() disalignment when considering Daylight Saving Time, as also stated in DateTime.difference() documentation.

To fix this we have to compare dates in utc, e.g.:

/// Gets difference of days between [date] and calling object.
int getDayDifference(DateTime date) => 
    DateTime.utc(year, month, day).difference(DateTime.utc(date.year, date.month, date.day)).inDays.abs();

Have a look at PR #104

How would I go about fixing this locally until they can get this fix out?

awatson32 avatar Sep 08 '22 20:09 awatson32

Hello guys, Please let us know if this issue is still there in version 1.0.0

ParthBaraiya avatar Sep 09 '22 21:09 ParthBaraiya

Hello guys, Please let us know if this issue is still there in version 1.0.0

I actually think this issue might have been introduced in 1.0.0, when I downgrade to 0.0.5 it seemed to go away. For me at least.

awatson32 avatar Sep 12 '22 14:09 awatson32

Downgrading to 0.0.5 from 1.0.0 also fixed the issue for me.

johnbmangold avatar Sep 14 '22 16:09 johnbmangold

@ParthBaraiya yes - this bug is present in 1.0.0

arekfajdek avatar Sep 15 '22 09:09 arekfajdek

how is this still labeled as waiting for a response? multiple people commented that this is a critical bug in version 1.0 - that basically makes this component unusable. Do you guys have any plan on fixing this issue?

arekfajdek avatar Oct 27 '22 12:10 arekfajdek

Fixed in 1.0.1 PR #136

faiyaz-shaikh avatar Nov 25 '22 09:11 faiyaz-shaikh