Port timestamp fix to 4.9 (#52426)

This commit is contained in:
Ryan Cavanaugh 2023-01-25 20:08:35 -08:00 committed by GitHub
parent e2868216f6
commit daf4e817a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -60,7 +60,12 @@ namespace ts {
export function getLocaleTimeString(system: System) {
return !system.now ?
new Date().toLocaleTimeString() :
system.now().toLocaleTimeString("en-US", { timeZone: "UTC" });
// On some systems / builds of Node, there's a non-breaking space between the time and AM/PM.
// This branch is solely for testing, so just switch it to a normal space for baseline stability.
// See:
// - https://github.com/nodejs/node/issues/45171
// - https://github.com/nodejs/node/issues/45753
system.now().toLocaleTimeString("en-US", { timeZone: "UTC" }).replace("\u202f", " ");
}
/**