Skip to content

Commit 66bfb2d

Browse files
committed
fix: 12hours format for input and ui overflow
1 parent 04f2ec1 commit 66bfb2d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/tools/timezone-converter/timezone-converter.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ function convertMinsToHrsMins(minutes: number) {
1717
const otherTimezones = useStorage<{ name: string }[]>('timezone-conv:zones', [{ name: 'Etc/GMT' }]);
1818
const currentTimezone = useStorage<string>('timezone-conv:current', browserTimezone);
1919
const use24HourTimeFormat = useStorage<boolean>('timezone-conv:24h', true);
20+
const format = computed(() => use24HourTimeFormat.value ? 'yyyy-MM-dd HH:mm:ss' : 'yyyy-MM-dd hh:mm:ss a');
21+
const timePickerProps = computed(() => use24HourTimeFormat.value ? ({ use12Hours: false }) : ({ use12Hours: true }));
2022
2123
const now = Date.now();
2224
const currentDatetimeRange = ref<[number, number]>([now, now]);
@@ -55,14 +57,17 @@ const countryToTimezonesOutput = computed(() => ctz.getTimezonesForCountry(count
5557
mb-2
5658
/>
5759
<n-date-picker
60+
:key="format"
5861
v-model:value="currentDatetimeRange"
5962
type="datetimerange"
63+
:format="format"
64+
:time-picker-props="timePickerProps"
6065
mb-2
6166
/>
6267

6368
<n-space justify="space-evenly">
6469
<input-copyable
65-
label="Current Timezone Offset (min)"
70+
label="Current Timezone Offset"
6671
label-position="left"
6772
:value="currentTimezoneOffset"
6873
readonly

0 commit comments

Comments
 (0)