mirror of
https://github.com/C9Glax/tranga-website.git
synced 2025-10-18 11:20:46 +02:00
Fix timezone offsets
This commit is contained in:
@@ -8,6 +8,7 @@
|
|||||||
<p
|
<p
|
||||||
style="
|
style="
|
||||||
background: linear-gradient(110deg, var(--color-pink), var(--color-blue));
|
background: linear-gradient(110deg, var(--color-pink), var(--color-blue));
|
||||||
|
background-clip: text;
|
||||||
-webkit-background-clip: text;
|
-webkit-background-clip: text;
|
||||||
-webkit-text-fill-color: transparent;
|
-webkit-text-fill-color: transparent;
|
||||||
"
|
"
|
||||||
@@ -27,7 +28,7 @@
|
|||||||
<UButton icon="i-lucide-brick-wall-shield" :to="`/actions?return=${$route.fullPath}`" :disabled="$route.fullPath.startsWith('/actions')" variant="soft" color="secondary" />
|
<UButton icon="i-lucide-brick-wall-shield" :to="`/actions?return=${$route.fullPath}`" :disabled="$route.fullPath.startsWith('/actions')" variant="soft" color="secondary" />
|
||||||
<UButton icon="i-lucide-plus" to="/search" color="primary" label="Manga" />
|
<UButton icon="i-lucide-plus" to="/search" color="primary" label="Manga" />
|
||||||
<UColorModeButton color="secondary" />
|
<UColorModeButton color="secondary" />
|
||||||
<UButton icon="i-lucide-settings" variant="ghost" :to="`/settings?return=${$route.fullPath}`" color="secondary" />
|
<UButton icon="i-lucide-settings" variant="ghost" :to="`/settings?return=${$route.fullPath}`" :disabled="$route.fullPath.startsWith('/settings')" color="secondary" />
|
||||||
</template>
|
</template>
|
||||||
</UHeader>
|
</UHeader>
|
||||||
<UMain>
|
<UMain>
|
||||||
|
@@ -1,9 +1,10 @@
|
|||||||
<template>
|
<template>
|
||||||
<TrangaPage rimless>
|
<TrangaPage rimless>
|
||||||
<template #center>
|
<template #center>
|
||||||
<USelect v-model="params.action" :items="ActionTypes?.map(a => a.split(/(?=[A-Z])/).join(' '))" class="w-50" @change="refreshData" />
|
<USelect v-model="params.action" :items="ActionTypes" class="w-50" @change="refreshData" />
|
||||||
<UInput v-model="params.start" trailing-icon="i-lucide-chevron-first" type="datetime-local" @change="refreshData" />
|
<UInput v-model="params.start" trailing-icon="i-lucide-chevron-first" type="datetime-local" @change="refreshData" />
|
||||||
<UInput v-model="params.end" icon="i-lucide-chevron-last" type="datetime-local" @change="refreshData" />
|
<UInput v-model="params.end" icon="i-lucide-chevron-last" type="datetime-local" @change="refreshData" />
|
||||||
|
<UButton color="primary" icon="i-lucide-rotate-ccw" @click="resetFilter" />
|
||||||
</template>
|
</template>
|
||||||
<template #actions>
|
<template #actions>
|
||||||
<UTooltip text="Reload" :kbds="['meta', 'R']">
|
<UTooltip text="Reload" :kbds="['meta', 'R']">
|
||||||
@@ -41,10 +42,11 @@ type ActionRecord = components['schemas']['ActionRecord'];
|
|||||||
|
|
||||||
const { $api } = useNuxtApp();
|
const { $api } = useNuxtApp();
|
||||||
|
|
||||||
const params = computed<Partial<Filter>>(() => { return { ...useRoute().query,
|
const timezoneOffsetMillis = new Date().getTimezoneOffset() * 60 * 1000;
|
||||||
start: new Date(Date.now()-(24 * 60 * 60 * 1000)).toISOString().slice(0, 16),
|
const params = ref<Partial<Filter>>({ ...useRoute().query,
|
||||||
end: new Date(Date.now()).toISOString().slice(0, 16),
|
start: new Date(Date.now()-(24 * 60 * 60 * 1000) - timezoneOffsetMillis).toISOString().slice(0, 16),
|
||||||
}});
|
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16)
|
||||||
|
});
|
||||||
const data = ref(await $api('/v2/Actions/Filter', { method: 'POST', body: params.value }));
|
const data = ref(await $api('/v2/Actions/Filter', { method: 'POST', body: params.value }));
|
||||||
const { data: ActionTypes } = useApi('/v2/Actions/Types', { key : FetchKeys.Actions.Types });
|
const { data: ActionTypes } = useApi('/v2/Actions/Types', { key : FetchKeys.Actions.Types });
|
||||||
|
|
||||||
@@ -75,6 +77,13 @@ const columns: TableColumn<ActionRecord>[] = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
const resetFilter = () => {
|
||||||
|
params.value = { ...useRoute().query,
|
||||||
|
start: new Date(Date.now()-(24 * 60 * 60 * 1000) - timezoneOffsetMillis).toISOString().slice(0, 16),
|
||||||
|
end: new Date(Date.now() - timezoneOffsetMillis).toISOString().slice(0, 16)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const refreshData = async (): Promise<void> => {
|
const refreshData = async (): Promise<void> => {
|
||||||
data.value = await $api('/v2/Actions/Filter', { method: 'POST', body: params.value });
|
data.value = await $api('/v2/Actions/Filter', { method: 'POST', body: params.value });
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user