mirror of
https://github.com/solidtime-io/solidtime.git
synced 2026-08-13 18:52:14 +01:00
add frontend support for the date formatting option
This commit is contained in:
committed by
Constantin Graf
parent
f69bc28316
commit
a076bb2fb0
@@ -43,7 +43,7 @@ const xAxisLabels = computed(() => {
|
||||
if (props.groupedType === 'week') {
|
||||
return props?.groupedData?.map((el) => formatWeek(el.key));
|
||||
}
|
||||
return props?.groupedData?.map((el) => formatDate(el.key ?? ''));
|
||||
return props?.groupedData?.map((el) => formatDate(el.key ?? '', organization?.value?.date_format));
|
||||
});
|
||||
const accentColor = useCssVar('--theme-color-chart', null, { observe: true });
|
||||
const labelColor = useCssVar('--color-text-secondary', null, { observe: true });
|
||||
|
||||
@@ -9,7 +9,8 @@ import { Calendar } from '@/Components/ui/calendar';
|
||||
import { CalendarIcon } from 'lucide-vue-next';
|
||||
import { formatDateLocalized } from '@/packages/ui/src/utils/time';
|
||||
import { parseDate } from '@internationalized/date';
|
||||
import { computed } from 'vue';
|
||||
import { computed, inject, type ComputedRef } from 'vue';
|
||||
import { type Organization } from '@/packages/api/src';
|
||||
|
||||
const model = defineModel<string | null>();
|
||||
const emit = defineEmits<{
|
||||
@@ -27,6 +28,8 @@ const handleBlur = () => {
|
||||
const date = computed(() => {
|
||||
return model.value ? parseDate(model.value) : undefined;
|
||||
});
|
||||
|
||||
const organization = inject<ComputedRef<Organization>>('organization');
|
||||
</script>
|
||||
|
||||
<template>
|
||||
@@ -41,7 +44,7 @@ const date = computed(() => {
|
||||
]"
|
||||
>
|
||||
<CalendarIcon class="mr-2 h-4 w-4" />
|
||||
{{ model ? formatDateLocalized(model) : 'Pick a date' }}
|
||||
{{ model ? formatDateLocalized(model, organization?.date_format) : 'Pick a date' }}
|
||||
</Button>
|
||||
</PopoverTrigger>
|
||||
<PopoverContent class="w-auto p-0">
|
||||
|
||||
Reference in New Issue
Block a user