File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11<template >
2- <div v-text =" formatted" ></div >
2+ <div v-text =" formatted" v-tooltip = " tooltip " ></div >
33</template >
44
55<script setup>
@@ -28,5 +28,22 @@ const formatted = computed(() => {
2828 return formatter .date (props .value .date ).toString ();
2929});
3030
31+ const tooltip = computed (() => {
32+ if (! props .value ) {
33+ return null ;
34+ }
35+
36+ const formatter = new DateFormatter ().options ({ dateStyle: ' long' , timeStyle: ' long' });
37+
38+ if (props .value .mode === ' range' ) {
39+ let start = new Date (props .value .start );
40+ let end = new Date (props .value .end );
41+
42+ return formatter .date (start) + ' – ' + formatter .date (end);
43+ }
44+
45+ return formatter .date (props .value .date ).toString ();
46+ });
47+
3148defineExpose (expose);
3249 </script >
Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ import Card from '../Card/Card.vue';
2424import Button from ' ../Button/Button.vue' ;
2525import Calendar from ' ../Calendar/Calendar.vue' ;
2626import Icon from ' ../Icon/Icon.vue' ;
27+ import Text from ' ../Text.vue' ;
2728
2829const emit = defineEmits ([' update:modelValue' ]);
2930
@@ -95,6 +96,16 @@ const calendarEvents = computed(() => ({
9596 },
9697}));
9798
99+ const timeZoneName = computed (() => props .modelValue ? .timeZone ?? null );
100+
101+ const timeZoneLabel = computed (() => {
102+ const tz = timeZoneName .value ;
103+ if (! tz) return null ;
104+
105+ const parts = new Intl.DateTimeFormat (undefined , { timeZone: tz, timeZoneName: ' short' }).formatToParts (props .modelValue .toDate ());
106+ return parts .find ((p ) => p .type === ' timeZoneName' )? .value ?? tz;
107+ });
108+
98109const isInvalid = computed (() => {
99110 // Check if the component has invalid state from form validation
100111 return props .modelValue === null && props .required ;
@@ -187,6 +198,12 @@ const getInputLabel = (part) => {
187198 < / div>
188199 < / template>
189200 < / div>
201+ < Text
202+ class = " text-gray-600 dark:text-gray-400 me-1"
203+ size= " xs"
204+ v- tooltip= " timeZoneName"
205+ : text= " timeZoneLabel"
206+ / >
190207 < Button
191208 v- if = " clearable && !readOnly"
192209 @click= " emit('update:modelValue', null)"
You can’t perform that action at this time.
0 commit comments