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

Hour slots are calculated with DST, causing duplicate hour to appear in single day view #57

Open
ptcs-juma opened this issue Feb 1, 2024 · 0 comments

Comments

@ptcs-juma
Copy link
Contributor

ptcs-juma commented Feb 1, 2024

image
image

How to reproduce the bug:

  1. Use Finnish time zone
  • Europe/Helsinki
  • Eastern Europe Standard Time
  • FLE Standard Time
  1. Setup data so that only one day is "selected".
  • Day: 2024-03-31
  • Start hour: 2
  • End hour: 5
  1. Draw the calendar
  2. The calendar should now include duplicate times for 04:00+03:00 hour.

This is caused by changes made in PR #46. The original method was correct as the time was adjusted based on UTC-time, but after the changes, the time is tied on the user's time zone rules.

Setting the hour to 3 or 4 for the original 2024-03-01 00:00:00+02:00 time produces 2024-03-01 04:00:00+03:00 time, thus a duplicate hour slot.

Using the original way of calculating hours generates correct times as seen below.

  private createDate(date: Date, hours: number, minutes: number): Date {
    const newDate = new Date(date);
    // Move UTC-time forwards.
    newDate.setTime(newDate.getTime() + (hours * 3600000) + (minutes * 60000));
    return newDate;
  }

image

@ptcs-juma ptcs-juma changed the title Hour slots are calculated with timezone rules, causing duplicate hour to appear in single day view Hour slots are calculated with DST, causing duplicate hour to appear in single day view Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant