bugfixing
This commit is contained in:
parent
9a41359da3
commit
51b2f0a065
@ -484,8 +484,7 @@
|
||||
//===============================================//
|
||||
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
||||
const formatOptions = {
|
||||
timeZone: "UTC", // Ensure UTC time zone
|
||||
hour12: true, // Use 12-hour format
|
||||
timeZone: "UTC",
|
||||
};
|
||||
|
||||
switch (tickMarkType) {
|
||||
@ -499,20 +498,25 @@
|
||||
formatOptions.day = "numeric";
|
||||
break;
|
||||
case 3: // TickMarkType.Time:
|
||||
formatOptions.hour = "numeric";
|
||||
formatOptions.hour12 = true; // Use 12-hour clock
|
||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
||||
break;
|
||||
case 4: // TickMarkType.TimeWithSeconds:
|
||||
formatOptions.hour = "numeric";
|
||||
formatOptions.minute = "2-digit";
|
||||
formatOptions.second = "2-digit";
|
||||
formatOptions.hour12 = true; // Use 12-hour clock
|
||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
||||
formatOptions.minute = "2-digit"; // Always show minutes with leading zero
|
||||
formatOptions.second = "2-digit"; // Always show seconds with leading zero
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
// Ensure this default case handles unexpected tickMarkType values
|
||||
}
|
||||
if ([3, 4]?.includes(tickMarkType)) {
|
||||
const date = new Date(timePoint?.timestamp * 1000);
|
||||
return new Intl.DateTimeFormat(locale, formatOptions)?.format(date);
|
||||
} else {
|
||||
const date = new Date(timePoint?.timestamp);
|
||||
return new Intl.DateTimeFormat(locale, formatOptions)?.format(date);
|
||||
}
|
||||
|
||||
// Use 'en-US' to ensure the format '10 PM'
|
||||
const date = new Date(timePoint.timestamp * 1000);
|
||||
return new Intl.DateTimeFormat('en-US', formatOptions).format(date);
|
||||
}
|
||||
|
||||
$: options = {
|
||||
|
||||
@ -456,8 +456,7 @@
|
||||
//===============================================//
|
||||
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
||||
const formatOptions = {
|
||||
timeZone: "UTC", // Ensure UTC time zone
|
||||
hour12: true, // Use 12-hour format
|
||||
timeZone: "UTC",
|
||||
};
|
||||
|
||||
switch (tickMarkType) {
|
||||
@ -471,20 +470,25 @@
|
||||
formatOptions.day = "numeric";
|
||||
break;
|
||||
case 3: // TickMarkType.Time:
|
||||
formatOptions.hour = "numeric";
|
||||
formatOptions.hour12 = true; // Use 12-hour clock
|
||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
||||
break;
|
||||
case 4: // TickMarkType.TimeWithSeconds:
|
||||
formatOptions.hour = "numeric";
|
||||
formatOptions.minute = "2-digit";
|
||||
formatOptions.second = "2-digit";
|
||||
formatOptions.hour12 = true; // Use 12-hour clock
|
||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
||||
formatOptions.minute = "2-digit"; // Always show minutes with leading zero
|
||||
formatOptions.second = "2-digit"; // Always show seconds with leading zero
|
||||
break;
|
||||
default:
|
||||
return "";
|
||||
// Ensure this default case handles unexpected tickMarkType values
|
||||
}
|
||||
if ([3, 4]?.includes(tickMarkType)) {
|
||||
const date = new Date(timePoint?.timestamp * 1000);
|
||||
return new Intl.DateTimeFormat(locale, formatOptions)?.format(date);
|
||||
} else {
|
||||
const date = new Date(timePoint?.timestamp);
|
||||
return new Intl.DateTimeFormat(locale, formatOptions)?.format(date);
|
||||
}
|
||||
|
||||
// Use 'en-US' to ensure the format '10 PM'
|
||||
const date = new Date(timePoint.timestamp * 1000);
|
||||
return new Intl.DateTimeFormat('en-US', formatOptions).format(date);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user