Skip to content
Closed

test L #71408

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/libs/DateUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,30 @@ function isYesterday(date: Date, timeZone: SelectedTimezone): boolean {
const yesterdayInTimeZone = toZonedTime(yesterday, timeZone);
return isSameDay(date, yesterdayInTimeZone);
}
function isYesterday1(date: Date, timeZone: SelectedTimezone): boolean {
Comment thread
blimpich marked this conversation as resolved.
const currentDate = new Date();
const yesterday = subDays(currentDate, 1); // Get the date for yesterday in the current time zone
const yesterdayInTimeZone = toZonedTime(yesterday, timeZone);
return isSameDay(date, yesterdayInTimeZone);
}
function isYesterday2(date: Date, timeZone: SelectedTimezone): boolean {
Comment thread
blimpich marked this conversation as resolved.
const currentDate = new Date();
const yesterday = subDays(currentDate, 1); // Get the date for yesterday in the current time zone
const yesterdayInTimeZone = toZonedTime(yesterday, timeZone);
return isSameDay(date, yesterdayInTimeZone);
}
function isYesterday3(date: Date, timeZone: SelectedTimezone): boolean {
Comment thread
blimpich marked this conversation as resolved.
const currentDate = new Date();
const yesterday = subDays(currentDate, 1); // Get the date for yesterday in the current time zone
const yesterdayInTimeZone = toZonedTime(yesterday, timeZone);
return isSameDay(date, yesterdayInTimeZone);
}
function isYesterday4(date: Date, timeZone: SelectedTimezone): boolean {
Comment thread
blimpich marked this conversation as resolved.
const currentDate = new Date();
const yesterday = subDays(currentDate, 1); // Get the date for yesterday in the current time zone
const yesterdayInTimeZone = toZonedTime(yesterday, timeZone);
return isSameDay(date, yesterdayInTimeZone);
}

/**
* We have to fall back to older timezone names for native platforms that do not ship with newer timezone names to avoid a crash.
Expand Down Expand Up @@ -929,6 +953,10 @@ const DateUtils = {
isToday,
isTomorrow,
isYesterday,
isYesterday1,
Comment thread
blimpich marked this conversation as resolved.
isYesterday2,
isYesterday3,
isYesterday4,
getMonthNames,
getDaysOfWeek,
formatWithUTCTimeZone,
Expand Down
Loading