Issue #1511: Date display problem :
- the time zone is used to calculate the date - use the offset to know if beginsOn and endsOn are the same day - refactor the <o-switch> Solves, for example, this display problem : The date range "2024-12-31 17:45 to 2025-01-01 01:00" in the Asia/Shanghai time zone (spanning different years and days) is equivalent to "2024-12-31 at 10:45 to 2024-12-31 at 18:00" in the Europe/Paris time zone (same year and same day).
This commit is contained in:
@@ -8,12 +8,13 @@ function formatDateISOStringWithoutTime(value: string): string {
|
||||
return parseDateTime(value).toISOString().split("T")[0];
|
||||
}
|
||||
|
||||
function formatDateString(value: string): string {
|
||||
function formatDateString(value: string, timeZone?: string): string {
|
||||
return parseDateTime(value).toLocaleString(locale(), {
|
||||
weekday: "long",
|
||||
year: "numeric",
|
||||
month: "long",
|
||||
day: "numeric",
|
||||
timeZone: timeZone,
|
||||
});
|
||||
}
|
||||
|
||||
@@ -21,7 +22,7 @@ function formatTimeString(value: string, timeZone?: string): string {
|
||||
return parseDateTime(value).toLocaleTimeString(locale(), {
|
||||
hour: "numeric",
|
||||
minute: "numeric",
|
||||
timeZone,
|
||||
timeZone: timeZone,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user