MCPcopy Create free account
hub / github.com/dailydotdev/apps / isLocalDateInTimezone

Function isLocalDateInTimezone

packages/shared/src/lib/timezones.ts:658–668  ·  view source on GitHub ↗
(
  date: Date,
  localDate: string,
  timezone?: string,
)

Source from the content-addressed store, hash-verified

656// `timezone`. The API reports streak days as local date strings, so compare
657// the day in that zone instead of turning the string into a UTC instant.
658export const isLocalDateInTimezone = (
659 date: Date,
660 localDate: string,
661 timezone?: string,
662): boolean => {
663 if (Number.isNaN(date.getTime())) {
664 return false;
665 }
666
667 return dateFormatInTimezone(date, 'yyyy-MM-dd', timezone) === localDate;
668};
669
670export const getTimezoneOffsetLabel = (timezone: string): string => {
671 const resolvedTimezone = timezone || DEFAULT_TIMEZONE;

Callers 1

getStreakFunction · 0.90

Calls 1

dateFormatInTimezoneFunction · 0.85

Tested by

no test coverage detected