File tree Expand file tree Collapse file tree
resources/js/components/ui Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import Calendar from '../Calendar/Calendar.vue';
2727import Icon from ' ../Icon/Icon.vue' ;
2828import Text from ' ../Text.vue' ;
2929import TimezoneHoverCard from ' ../TimezoneHoverCard.vue' ;
30+ import { getAdditionalTimezones } from ' ./util.js' ;
3031
3132const emit = defineEmits ([' update:modelValue' ]);
3233
@@ -108,6 +109,8 @@ const timeZoneLabel = computed(() => {
108109 return parts .find ((p ) => p .type === ' timeZoneName' )? .value ?? tz;
109110});
110111
112+ const additionalTimezones = computed (() => getAdditionalTimezones (timeZoneName .value ));
113+
111114const isInvalid = computed (() => {
112115 // Check if the component has invalid state from form validation
113116 return props .modelValue === null && props .required ;
@@ -203,7 +206,7 @@ const getInputLabel = (part) => {
203206 < TimezoneHoverCard
204207 v- if = " timeZoneLabel"
205208 : date= " modelValue.toDate()"
206- : additional- timezones= " [{ timezone: timeZoneName, label: __('This field') }] "
209+ : additional- timezones= " additionalTimezones "
207210 side= " top"
208211 >
209212 < Text class = " text-gray-600 dark:text-gray-400 me-1" size= " xs" : text= " timeZoneLabel" / >
Original file line number Diff line number Diff line change 1+ import { config } from '@api' ;
2+ import { getLocalTimeZone } from '@internationalized/date' ;
3+
4+ export function getAdditionalTimezones ( timeZone ) {
5+ if ( ! timeZone ) return [ ] ;
6+ if ( timeZone === ( config . get ( 'displayTimezone' ) ?? 'UTC' ) ) return [ ] ;
7+ if ( timeZone === getLocalTimeZone ( ) ) return [ ] ;
8+ return [ { timezone : timeZone , label : __ ( 'This field' ) } ] ;
9+ }
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import Icon from '../Icon/Icon.vue';
2727import Text from ' ../Text.vue' ;
2828import TimezoneHoverCard from ' ../TimezoneHoverCard.vue' ;
2929import { parseAbsoluteToLocal } from ' @internationalized/date' ;
30+ import { getAdditionalTimezones } from ' ../DatePicker/util.js' ;
3031
3132const emit = defineEmits ([' update:modelValue' ]);
3233
@@ -110,6 +111,8 @@ const timeZoneLabel = computed(() => {
110111 return parts .find ((p ) => p .type === ' timeZoneName' )? .value ?? tz;
111112});
112113
114+ const additionalTimezones = computed (() => getAdditionalTimezones (timeZoneName .value ));
115+
113116const hoverCardDate = computed (() => {
114117 if (! props .modelValue ? .start || ! props .modelValue ? .end ) return null ;
115118 return { start: props .modelValue .start .toDate (), end: props .modelValue .end .toDate () };
@@ -182,7 +185,7 @@ const hoverCardDate = computed(() => {
182185 < TimezoneHoverCard
183186 v- if = " timeZoneLabel && hoverCardDate"
184187 : date= " hoverCardDate"
185- : additional- timezones= " [{ timezone: timeZoneName, label: __('This field') }] "
188+ : additional- timezones= " additionalTimezones "
186189 side= " top"
187190 >
188191 < Text class = " text-gray-600 dark:text-gray-400 me-1" size= " xs" : text= " timeZoneLabel" / >
You can’t perform that action at this time.
0 commit comments