feat: automatically detect hour format

This commit is contained in:
Elias Schneider
2022-10-16 20:21:35 +02:00
parent 13d6f05b98
commit 4e3f6be8e3
5 changed files with 8 additions and 24 deletions

View File

@@ -14,6 +14,7 @@ import { useClipboard } from "@mantine/hooks";
import { useModals } from "@mantine/modals";
import { NextLink } from "@mantine/next";
import moment from "moment";
import getConfig from "next/config";
import { useRouter } from "next/router";
import { useEffect, useState } from "react";
import { TbLink, TbTrash } from "react-icons/tb";
@@ -22,7 +23,6 @@ import useUser from "../../hooks/user.hook";
import shareService from "../../services/share.service";
import { MyShare } from "../../types/share.type";
import toast from "../../utils/toast.util";
import getConfig from "next/config";
const { publicRuntimeConfig } = getConfig();
@@ -77,9 +77,7 @@ const MyShares = () => {
<td>
{moment(share.expiration).unix() === 0
? "Never"
: publicRuntimeConfig.TWELVE_HOUR_TIME === "true"
? moment(share.expiration).format("MMMM Do YYYY, h:mm a")
: moment(share.expiration).format("MMMM DD YYYY, HH:mm")}
: moment(share.expiration).format("LLL")}
</td>
<td>
<Group position="right">