Skip to content

Commit 9a2af2e

Browse files
committed
respect organization time format settings in api tokens section
1 parent 2e3a517 commit 9a2af2e

File tree

3 files changed

+10
-6
lines changed

3 files changed

+10
-6
lines changed

resources/css/app.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
--theme-color-input-select-active: rgb(var(--color-accent-300));
4545
--theme-color-input-select-active-hover: rgb(var(--color-accent-200));
4646

47-
--color-accent-default: rgb(var(--color-accent-900));
47+
--color-accent-default: rgba(var(--color-accent-300), 0.2);
4848
--color-accent-foreground: rgb(var(--color-accent-100));
4949
}
5050

resources/js/Pages/Profile/Partials/ApiTokensForm.vue

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<script setup lang="ts">
22
import FormSection from '@/Components/FormSection.vue';
33
import PrimaryButton from '@/packages/ui/src/Buttons/PrimaryButton.vue';
4-
import {computed, ref} from 'vue';
4+
import {computed, ref, inject, type ComputedRef} from 'vue';
55
import InputLabel from '@/packages/ui/src/Input/InputLabel.vue';
66
import {
77
api,
@@ -23,6 +23,7 @@ import {useNotificationsStore} from "@/utils/notification";
2323
import {useClipboard} from "@vueuse/core";
2424
import { formatDateTimeLocalized} from "../../../packages/ui/src/utils/time";
2525
import {ClockIcon} from "@heroicons/vue/20/solid";
26+
import type { Organization } from '@/packages/api/src';
2627
2728
const queryClient = useQueryClient();
2829
@@ -34,6 +35,8 @@ const newToken = ref('');
3435
3536
const { copy, copied, isSupported } = useClipboard();
3637
38+
const organization = inject<ComputedRef<Organization>>('organization');
39+
3740
async function createApiToken(){
3841
await handleApiRequestNotifications(
3942
() =>
@@ -213,10 +216,10 @@ const revokeApiTokenMutation = useMutation({
213216
<div>{{ token.name }}</div>
214217
<div class="text-sm text-text-tertiary space-x-3">
215218
<span v-if="token.created_at">
216-
Created at {{ formatDateTimeLocalized(token.created_at) }}
219+
Created at {{ formatDateTimeLocalized(token.created_at, organization?.date_format, organization?.time_format) }}
217220
</span>
218221
<span v-if="token.expires_at">
219-
Expires at {{ formatDateTimeLocalized(token.expires_at) }}
222+
Expires at {{ formatDateTimeLocalized(token.expires_at, organization?.date_format, organization?.time_format) }}
220223
</span>
221224
<span v-if="token.revoked">
222225
Revoked

resources/js/packages/ui/src/utils/time.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,8 +146,9 @@ export function formatDateLocalized(date: string, format: DateFormat = 'point-se
146146
return getLocalizedDayJs(date).format(dateFormatMap[format]);
147147
}
148148

149-
export function formatDateTimeLocalized(date: string): string {
150-
return getLocalizedDayJs(date).format('DD.MM.YYYY HH:mm');
149+
export function formatDateTimeLocalized(date: string, dateFormat?: DateFormat, timeFormat?: TimeFormat): string {
150+
const format = `${dateFormatMap[dateFormat ?? 'point-separated-d-m-yyyy']} ${timeFormat === '12-hours' ? 'hh:mm A' : 'HH:mm'}`;
151+
return getLocalizedDayJs(date).format(format);
151152
}
152153

153154
export function formatWeek(date: string | null): string {

0 commit comments

Comments
 (0)