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 { ...@@ -4,7 +4,7 @@ import {
dateTimeAsIsoNoDateIfToday, dateTimeAsIsoNoDateIfToday,
dateTimeAsUS, dateTimeAsUS,
dateTimeAsUSNoDateIfToday, dateTimeAsUSNoDateIfToday,
dateTimeAsLocal, getDateTimeAsLocalFormat,
dateTimeFromNow, dateTimeFromNow,
toClockMilliseconds, toClockMilliseconds,
toClockSeconds, toClockSeconds,
...@@ -176,7 +176,7 @@ export const getCategories = (): ValueFormatCategory[] => [ ...@@ -176,7 +176,7 @@ export const getCategories = (): ValueFormatCategory[] => [
{ name: 'Datetime ISO (No date if today)', id: 'dateTimeAsIsoNoDateIfToday', fn: dateTimeAsIsoNoDateIfToday }, { name: 'Datetime ISO (No date if today)', id: 'dateTimeAsIsoNoDateIfToday', fn: dateTimeAsIsoNoDateIfToday },
{ name: 'Datetime US', id: 'dateTimeAsUS', fn: dateTimeAsUS }, { name: 'Datetime US', id: 'dateTimeAsUS', fn: dateTimeAsUS },
{ name: 'Datetime US (No date if today)', id: 'dateTimeAsUSNoDateIfToday', fn: dateTimeAsUSNoDateIfToday }, { 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 }, { name: 'From Now', id: 'dateTimeFromNow', fn: dateTimeFromNow },
], ],
}, },
......
...@@ -369,16 +369,19 @@ export const dateTimeAsIso = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss'); ...@@ -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 dateTimeAsIsoNoDateIfToday = toDateTimeValueFormatter('YYYY-MM-DD HH:mm:ss', 'HH:mm:ss');
export const dateTimeAsUS = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a'); 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 dateTimeAsUSNoDateIfToday = toDateTimeValueFormatter('MM/DD/YYYY h:mm:ss a', 'h:mm:ss a');
export const dateTimeAsLocal = toDateTimeValueFormatter(
localTimeFormat({ export function getDateTimeAsLocalFormat() {
year: 'numeric', return toDateTimeValueFormatter(
month: '2-digit', localTimeFormat({
day: '2-digit', year: 'numeric',
hour: '2-digit', month: '2-digit',
minute: '2-digit', day: '2-digit',
second: '2-digit', hour: '2-digit',
}) minute: '2-digit',
); second: '2-digit',
})
);
}
export function dateTimeFromNow( export function dateTimeFromNow(
value: number, 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