mirror of
https://github.com/Drop-OSS/drop.git
synced 2025-11-13 16:22:39 +10:00
refactor: remove momentjs
This commit is contained in:
@ -68,7 +68,9 @@
|
||||
</ul>
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-zinc-400">
|
||||
{{ moment(client.lastConnected).fromNow() }}
|
||||
{{
|
||||
DateTime.fromISO(client.lastConnected).diffNow().toHuman()
|
||||
}}
|
||||
</td>
|
||||
<td
|
||||
class="relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-3"
|
||||
@ -91,7 +93,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { CheckIcon } from "@heroicons/vue/24/outline";
|
||||
import moment from "moment";
|
||||
import { DateTime } from "luxon";
|
||||
|
||||
const clients = await $dropFetch("/api/v1/user/client");
|
||||
|
||||
|
||||
@ -352,7 +352,6 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ClientOnly } from "#build/components";
|
||||
import {
|
||||
Dialog,
|
||||
DialogPanel,
|
||||
@ -380,8 +379,8 @@ import {
|
||||
XCircleIcon,
|
||||
} from "@heroicons/vue/24/solid";
|
||||
import type { Invitation } from "@prisma/client";
|
||||
import moment from "moment";
|
||||
import type { SerializeObject } from "nitropack";
|
||||
import { DateTime, DurationLike } from "luxon";
|
||||
|
||||
definePageMeta({
|
||||
layout: "admin",
|
||||
@ -439,13 +438,25 @@ const validEmail = computed(() =>
|
||||
const isAdmin = ref(false);
|
||||
|
||||
// Label to parameters to moment.js .add()
|
||||
const expiry = {
|
||||
"3 days": [3, "days"],
|
||||
"7 days": [7, "days"],
|
||||
"1 month": [1, "month"],
|
||||
"6 months": [6, "month"],
|
||||
"1 year": [1, "year"],
|
||||
Never: [3000, "year"], // Never is relative, right?
|
||||
const expiry: Record<string, DurationLike> = {
|
||||
"3 days": {
|
||||
days: 3,
|
||||
},
|
||||
"7 days": {
|
||||
days: 7,
|
||||
},
|
||||
"1 month": {
|
||||
month: 1,
|
||||
},
|
||||
"6 months": {
|
||||
months: 6,
|
||||
},
|
||||
"1 year": {
|
||||
year: 1,
|
||||
},
|
||||
Never: {
|
||||
year: 3000,
|
||||
}, // Never is relative, right?
|
||||
};
|
||||
const expiryKey = ref<keyof typeof expiry>(Object.keys(expiry)[0] as any); // Cast to any because we just know it's okay
|
||||
|
||||
@ -453,9 +464,7 @@ const loading = ref(false);
|
||||
const error = ref<undefined | string>();
|
||||
|
||||
async function invite() {
|
||||
const expiryDate = moment()
|
||||
.add(...expiry[expiryKey.value])
|
||||
.toJSON();
|
||||
const expiryDate = DateTime.now().plus(expiry[expiryKey.value]).toJSON();
|
||||
|
||||
const newInvitation = await $dropFetch("/api/v1/admin/auth/invitation", {
|
||||
method: "POST",
|
||||
|
||||
@ -54,7 +54,11 @@
|
||||
Released
|
||||
</td>
|
||||
<td class="whitespace-nowrap px-3 py-4 text-sm text-zinc-400">
|
||||
{{ moment(game.mReleased).format("Do MMMM, YYYY") }}
|
||||
{{
|
||||
DateTime.fromJSDate(game.mReleased).toFormat(
|
||||
"Do MMMM, YYYY"
|
||||
)
|
||||
}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@ -166,7 +170,7 @@ import { ArrowTopRightOnSquareIcon } from "@heroicons/vue/24/outline";
|
||||
import { StarIcon } from "@heroicons/vue/24/solid";
|
||||
import { type Game, type GameVersion } from "@prisma/client";
|
||||
import { micromark } from "micromark";
|
||||
import moment from "moment";
|
||||
import { DateTime } from "luxon";
|
||||
import { PlatformClient } from "~/composables/types";
|
||||
import { ref } from "vue";
|
||||
import AddLibraryButton from "~/components/AddLibraryButton.vue";
|
||||
|
||||
Reference in New Issue
Block a user