ui fix
This commit is contained in:
parent
0f9f809f4d
commit
08b1b2bfe0
@ -484,7 +484,8 @@
|
|||||||
//===============================================//
|
//===============================================//
|
||||||
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
||||||
const formatOptions = {
|
const formatOptions = {
|
||||||
timeZone: "UTC",
|
timeZone: "UTC", // Ensure UTC time zone
|
||||||
|
hour12: true, // Use 12-hour format
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (tickMarkType) {
|
switch (tickMarkType) {
|
||||||
@ -498,25 +499,20 @@
|
|||||||
formatOptions.day = "numeric";
|
formatOptions.day = "numeric";
|
||||||
break;
|
break;
|
||||||
case 3: // TickMarkType.Time:
|
case 3: // TickMarkType.Time:
|
||||||
formatOptions.hour12 = true; // Use 12-hour clock
|
formatOptions.hour = "numeric";
|
||||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
|
||||||
break;
|
break;
|
||||||
case 4: // TickMarkType.TimeWithSeconds:
|
case 4: // TickMarkType.TimeWithSeconds:
|
||||||
formatOptions.hour12 = true; // Use 12-hour clock
|
formatOptions.hour = "numeric";
|
||||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
formatOptions.minute = "2-digit";
|
||||||
formatOptions.minute = "2-digit"; // Always show minutes with leading zero
|
formatOptions.second = "2-digit";
|
||||||
formatOptions.second = "2-digit"; // Always show seconds with leading zero
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Ensure this default case handles unexpected tickMarkType values
|
return "";
|
||||||
}
|
|
||||||
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 = {
|
$: options = {
|
||||||
|
|||||||
@ -456,7 +456,8 @@
|
|||||||
//===============================================//
|
//===============================================//
|
||||||
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
function defaultTickMarkFormatter(timePoint, tickMarkType, locale) {
|
||||||
const formatOptions = {
|
const formatOptions = {
|
||||||
timeZone: "UTC",
|
timeZone: "UTC", // Ensure UTC time zone
|
||||||
|
hour12: true, // Use 12-hour format
|
||||||
};
|
};
|
||||||
|
|
||||||
switch (tickMarkType) {
|
switch (tickMarkType) {
|
||||||
@ -470,27 +471,23 @@
|
|||||||
formatOptions.day = "numeric";
|
formatOptions.day = "numeric";
|
||||||
break;
|
break;
|
||||||
case 3: // TickMarkType.Time:
|
case 3: // TickMarkType.Time:
|
||||||
formatOptions.hour12 = true; // Use 12-hour clock
|
formatOptions.hour = "numeric";
|
||||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
|
||||||
break;
|
break;
|
||||||
case 4: // TickMarkType.TimeWithSeconds:
|
case 4: // TickMarkType.TimeWithSeconds:
|
||||||
formatOptions.hour12 = true; // Use 12-hour clock
|
formatOptions.hour = "numeric";
|
||||||
formatOptions.hour = "numeric"; // Use numeric hour without leading zero
|
formatOptions.minute = "2-digit";
|
||||||
formatOptions.minute = "2-digit"; // Always show minutes with leading zero
|
formatOptions.second = "2-digit";
|
||||||
formatOptions.second = "2-digit"; // Always show seconds with leading zero
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
// Ensure this default case handles unexpected tickMarkType values
|
return "";
|
||||||
}
|
|
||||||
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 = {
|
$: options = {
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user