Commit 6a9bfa19 by Torkel Ödegaard Committed by GitHub

Themes: Fix issue generating themes due to code in @grafana/data accessing…

Themes: Fix issue generating themes due to code in @grafana/data accessing window object during module load (#27441)
parent f22f0a89
......@@ -4,7 +4,7 @@ import {
dateTimeAsIsoNoDateIfToday,
dateTimeAsUS,
dateTimeAsUSNoDateIfToday,
dateTimeAsLocal,
getDateTimeAsLocalFormat,
dateTimeFromNow,
toClockMilliseconds,
toClockSeconds,
......@@ -176,7 +176,7 @@ export const getCategories = (): ValueFormatCategory[] => [
{ name: 'Datetime ISO (No date if today)', id: 'dateTimeAsIsoNoDateIfToday', fn: dateTimeAsIsoNoDateIfToday },
{ name: 'Datetime US', id: 'dateTimeAsUS', fn: dateTimeAsUS },
{ name: 'Datetime US (No date if today)', id: 'dateTimeAsUSNoDateIfToday', fn: dateTimeAsUSNoDateIfToday },
{ name: 'Datetime local', id: 'dateTimeAsLocal', fn: dateTimeAsLocal },
{ name: 'Datetime local', id: 'dateTimeAsLocal', fn: getDateTimeAsLocalFormat() },
{ name: 'From Now', id: 'dateTimeFromNow', fn: dateTimeFromNow },
],
},
......
......@@ -369,16 +369,19 @@ export const dateTimeAsIso = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss');
export const dateTimeAsIsoNoDateIfToday = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss', 'HH:mm:ss');
export const dateTimeAsUS = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a');
export const dateTimeAsUSNoDateIfToday = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a', 'h:mm:ss a');
export const dateTimeAsLocal = toDateTimeValueFormatter(
localTimeFormat({
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})
);
export function getDateTimeAsLocalFormat() {
return toDateTimeValueFormatter(
localTimeFormat({
year: 'numeric',
month: '2-digit',
day: '2-digit',
hour: '2-digit',
minute: '2-digit',
second: '2-digit',
})
);
}
export function dateTimeFromNow(
value: number,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment