diff --git a/src/helpers/hourToSalutation.ts b/src/helpers/hourToSalutation.ts index 96eca46c..68a866f6 100644 --- a/src/helpers/hourToSalutation.ts +++ b/src/helpers/hourToSalutation.ts @@ -1,7 +1,10 @@ +import {useNow} from '@vueuse/core' +import {Ref} from 'vue' + const TRANSLATION_KEY_PREFIX = 'home.welcome' -export function hourToSalutation(now: Date = new Date()): String { - const hours = new Date(now).getHours() +export function hourToSalutation(now: Date | Ref = useNow()): String { + const hours = now instanceof Date ? new Date(now).getHours() : new Date(now.value).getHours() if (hours < 5) { return `${TRANSLATION_KEY_PREFIX}Night`