@@ -5,19 +5,17 @@ import {
55 PopoverTrigger ,
66} from ' @/Components/ui/popover' ;
77import { RangeCalendar } from ' @/Components/ui/range-calendar' ;
8- import {
9- CalendarDate ,
10- getLocalTimeZone ,
11- } from ' @internationalized/date' ;
8+ import { CalendarDate } from ' @internationalized/date' ;
129import { CalendarIcon } from ' lucide-vue-next' ;
1310import { computed , ref , inject , type ComputedRef , watch } from ' vue' ;
1411import { twMerge } from ' tailwind-merge' ;
1512import {
1613 getDayJsInstance ,
1714 getLocalizedDayJs ,
1815} from ' @/packages/ui/src/utils/time' ;
19- import { formatDateLocalized } from ' @/packages/ui/src/utils/time' ;
2016import { type Organization } from ' @/packages/api/src' ;
17+ import { getUserTimezone } from ' @/packages/ui/src/utils/settings' ;
18+ import { formatDate } from ' @/packages/ui/src/utils/time' ;
2119
2220const props = defineProps <{
2321 start: string ;
@@ -59,12 +57,13 @@ const modelValue = computed<CalendarDateRange>({
5957 }),
6058 set : (newValue ) => {
6159 if (newValue .start ) {
62- const date = newValue .start .toDate (getLocalTimeZone ());
63- emit (' update:start' , getDayJsInstance ()(date ).format (' YYYY-MM-DD' ));
60+ console .log (newValue .start );
61+ const date = newValue .start .toDate (getUserTimezone ());
62+ emit (' update:start' , getLocalizedDayJs (date .toString ()).format ());
6463 }
6564 if (newValue .end ) {
66- const date = newValue .end .toDate (getLocalTimeZone ());
67- emit (' update:end' , getDayJsInstance ()( date ) .format (' YYYY-MM-DD ' ));
65+ const date = newValue .end .toDate (getUserTimezone ());
66+ emit (' update:end' , getLocalizedDayJs ( date . toString ()) .format ());
6867 }
6968 },
7069});
@@ -219,12 +218,27 @@ watch(open, (value) => {
219218 <CalendarIcon class =" mr-2 h-4 w-4" />
220219 <template v-if =" modelValue .start " >
221220 <template v-if =" modelValue .end " >
222- {{ formatDateLocalized(modelValue.start.toString(), organization?.date_format) }}
221+ {{
222+ formatDate(
223+ modelValue.start.toString(),
224+ organization?.date_format
225+ )
226+ }}
223227 -
224- {{ formatDateLocalized(modelValue.end.toString(), organization?.date_format) }}
228+ {{
229+ formatDate(
230+ modelValue.end.toString(),
231+ organization?.date_format
232+ )
233+ }}
225234 </template >
226235 <template v-else >
227- {{ formatDateLocalized(modelValue.start.toString(), organization?.date_format) }}
236+ {{
237+ formatDate(
238+ modelValue.start.toString(),
239+ organization?.date_format
240+ )
241+ }}
228242 </template >
229243 </template >
230244 <template v-else > Pick a date </template >
0 commit comments