Skyost / FlutterWeekView

Displays a highly customizable week view (or day view) which is able to display events, to be scrolled, to be zoomed-in & out and a lot more !
https://pub.dev/packages/flutter_week_view
MIT License
208 stars 89 forks source link

Red indicator indicates wrong current time #9

Closed zephyo closed 4 years ago

zephyo commented 4 years ago

To Reproduce Steps to reproduce the behavior:

  1. Flutter run example
  2. Click on 'Demo Day View'
  3. Red indicator does not match current time on my OS/timezone
  4. See error

Using Android emulator on Mac OS.

Screen Shot 2020-02-02 at 12 39 42 PM
Skyost commented 4 years ago

Seems to be a timezone problem. What is your OS timezone ? And your device timezone ?

zephyo commented 4 years ago

PST, California! Ah - my bad, thought the widget automatically detected timezone.

On Sun, Feb 2, 2020 at 1:02 PM Hugo Delaunay notifications@github.com wrote:

Seems to be a timezone problem isn't it ? What is your OS timezone ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Skyost/FlutterWeekView/issues/9?email_source=notifications&email_token=AFPGKNVCKCJEX4EP3KIWJYLRA4YGFA5CNFSM4KO36U32YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEKSA46A#issuecomment-581176952, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFPGKNTZV5OMPSTAEWXFC7LRA4YGFANCNFSM4KO36U3Q .

-- Class of 2021 | Stanford University zephyo.github.io http://zephyo.github.io

Skyost commented 4 years ago

Well, it should. I will investigate.

Skyost commented 4 years ago

@zephyo If you try to execute the following code :

DateTime date = DateTime.now();
print('Hour : ${date.hour}, Minute : ${date.minute}.');

Are you getting the expected output ?

FernandaMayumi commented 4 years ago

I'm also having the same problem, I ran the test and it was an hour earlier than the indicator.

Skyost commented 4 years ago

@FernandaMayumi

  1. What are your OS timezone and your device timezone ?
  2. Is it possible for you to run the code snippet just above please ?
FernandaMayumi commented 4 years ago

@Skyost Brazil, GMT-03:00 Brasilia Standard Time

I ran the code above and gave my device an extra hour

Skyost commented 4 years ago

@FernandaMayumi Hmm yes, so does the plugin. I'm gonna investigate and post my results in this issue.

Skyost commented 4 years ago

Okay, according to various sources it seems to be a problem with Android emulators only. Btw as you can see by running the code snippet above, it's more of a bug from Flutter than from this plugin.

Please don't hesitate reopening if it happens on a physical device, I will try to find a fix that will also work on this plugin.

valentinkatic commented 4 years ago

I'm also having this problem and I'm testing app on web platform. My timezone is UTC+1 (Europe/Zagreb). print("now: ${DateTime.now()}"); returns now: 2020-02-13 11:32:20.025 and my system time is also 11:32, but red indicator is on 12:32.

I believe the problem is with adding +1 to hours when determining top offset in createCurrentTimeRule method.

Widget createCurrentTimeRule() {
    DateTime now = DateTime.now();
    return Positioned(
      top: calculateTopOffset(now.hour + 1, now.minute),
      left: widget.hoursColumnWidth,
      right: 0,
      child: Container(
        height: 1,
        color: widget.currentTimeRuleColor,
      ),
    );
  }

Screenshot 2020-02-13 at 11 32 01

Skyost commented 4 years ago

You are right @valentinkatic ! I don't really know why I've set hour + 1, I think it was when I was using another system... Nevermind, it seems to be fixed anyway :wink: