diff --git a/lib/Stats.js b/lib/Stats.js index 153e6f0e8af..0de02f3af22 100644 --- a/lib/Stats.js +++ b/lib/Stats.js @@ -974,16 +974,22 @@ class Stats { } if (typeof obj.builtAt === "number") { const builtAtDate = new Date(obj.builtAt); + let timeZone = Intl.DateTimeFormat().resolvedOptions().timeZone; + // Force UTC if runtime timezone could not be detected. + if (!timeZone || timeZone.toLowerCase() === "etc/unknown") { + timeZone = "UTC"; + } colors.normal("Built at: "); colors.normal( builtAtDate.toLocaleDateString(undefined, { day: "2-digit", month: "2-digit", - year: "numeric" + year: "numeric", + timeZone }) ); colors.normal(" "); - colors.bold(builtAtDate.toLocaleTimeString()); + colors.bold(builtAtDate.toLocaleTimeString(undefined, { timeZone })); newline(); } if (obj.env) {