Skip to content

Times should be updated with local times#4268

Open
glickgNU wants to merge 3 commits into
developfrom
#4259-time-zone-availability-time-slots
Open

Times should be updated with local times#4268
glickgNU wants to merge 3 commits into
developfrom
#4259-time-zone-availability-time-slots

Conversation

@glickgNU

@glickgNU glickgNU commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Changes

Hours shown on the calendar now will be updated depending on the user's time zone.
If the hours roll over to a new day, the day is also updated accordingly.
Daylight savings is also factored in too.

Test Cases

  • Changing my timezone to different times causes the hours to change accordingly and correctly.
  • When hovering over times that lead to a new day, then the day changes too.

To Do

Any remaining things that need to get done

  • item 1
  • ...

Checklist

It can be helpful to check the Checks and Files changed tabs.
Please review the contributor guide and reach out to your Tech Lead if anything is unclear.
Please request reviewers and ping on slack only after you've gone through this whole checklist.

  • All commits are tagged with the ticket number
  • No linting errors / newline at end of file warnings
  • All code follows repository-configured prettier formatting
  • No merge conflicts
  • All checks passing
  • Screenshots of UI changes (see Screenshots section)
  • Remove any non-applicable sections of this template
  • Assign the PR to yourself
  • No yarn.lock changes (unless dependencies have changed)
  • Request reviewers & ping on Slack
  • PR is linked to the ticket (fill in the closes line below)

Closes #4259

@staysgt staysgt self-requested a review June 9, 2026 00:08

@staysgt staysgt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good so far! left a few comments

Comment thread src/frontend/src/utils/design-review.utils.ts Outdated
Comment thread src/frontend/src/utils/design-review.utils.ts Outdated
Comment on lines +137 to +151
const AMorPM = (time: string, offset: number) => {
const startTime = Number(time.charAt(0) + (isTwoDigitHour(time) ? time.charAt(1) : ''));
let AMorPM = time.charAt(time.length - 2) + time.charAt(time.length - 1);

const flipAMPM = () => {
if (AMorPM === 'AM') return 'PM';
return 'AM';
};

// if odd, the AM / PM should be flipped
const doFlip = Math.floor((startTime + offset - 1) / 12) % 2 === 1;
if (doFlip) AMorPM = flipAMPM();

return AMorPM;
};

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bunch of the am/pm's are messed up on the calendar between time zones, I think since the offset could make the number negative, that might be causing a problem

London:
Image

SF:
Image

@staysgt staysgt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job!

@staysgt staysgt requested a review from wavehassman June 9, 2026 20:35

@wavehassman wavehassman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The bug here is just changing the labels on the availability selector. I'm pretty sure the only changes necessary are reviewTimesInCurrentTimeZone and its three call sites in EditAvailability, SingleAvailabilityView, and AvailabilityScheduleView

return new Date(year, month, 1 + dayDiff + (nth - 1) * 7);
};

const daylightSavings = () => {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of manually computing US DST dates to determine EST's offset, use Intl since the browser already knows it

@@ -13,6 +13,7 @@ import { useToast } from '../../../hooks/toasts.hooks';
import { formatEventTime } from 'shared';

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

formatEventTime(date) with no timezone argument already uses the browser's local timezone because that's dayjs's default behavior
So you don't need to wrap it with formatHourInCurrentTimeZone, you only need to wrap formatHour

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

Successfully merging this pull request may close these issues.

[Maintenance] - time zone availability time slots

3 participants