return reactive isUTCBased

This commit is contained in:
David Tsay 2024-04-17 11:32:10 -07:00
parent d0a77637c0
commit a11fcc3231

View File

@ -34,7 +34,8 @@ const DEFAULT_DURATION_FORMATTER = 'duration';
* observeTimeSystem: () => void, * observeTimeSystem: () => void,
* timeSystemKey: import('vue').Ref<string>, * timeSystemKey: import('vue').Ref<string>,
* timeSystemFormatter: import('vue').Ref<() => void>, * timeSystemFormatter: import('vue').Ref<() => void>,
* timeSystemDurationFormatter: import('vue').Ref<() => void> * timeSystemDurationFormatter: import('vue').Ref<() => void>,
* isTimeSystemUTCBased: import('vue').Ref<boolean>
* }} * }}
*/ */
export function useTimeSystem(openmct, options) { export function useTimeSystem(openmct, options) {
@ -47,6 +48,7 @@ export function useTimeSystem(openmct, options) {
const timeSystemDurationFormatter = ref( const timeSystemDurationFormatter = ref(
getFormatter(openmct, currentTimeSystem.durationFormat || DEFAULT_DURATION_FORMATTER) getFormatter(openmct, currentTimeSystem.durationFormat || DEFAULT_DURATION_FORMATTER)
); );
const isTimeSystemUTCBased = ref(currentTimeSystem.isUTCBased);
onBeforeUnmount(() => stopObservingTimeSystem?.()); onBeforeUnmount(() => stopObservingTimeSystem?.());
@ -62,13 +64,15 @@ export function useTimeSystem(openmct, options) {
openmct, openmct,
timeSystem.durationFormat || DEFAULT_DURATION_FORMATTER timeSystem.durationFormat || DEFAULT_DURATION_FORMATTER
); );
isTimeSystemUTCBased.value = timeSystem.isUTCBased;
} }
return { return {
observeTimeSystem, observeTimeSystem,
timeSystemKey, timeSystemKey,
timeSystemFormatter, timeSystemFormatter,
timeSystemDurationFormatter timeSystemDurationFormatter,
isTimeSystemUTCBased
}; };
} }