feat: formatting Date

Signed-off-by: Ryan Wang <i@ryanc.cc>
pull/603/head
Ryan Wang 2 years ago
parent 3ee45a117e
commit dc823ac20b

@ -3,6 +3,7 @@ import { VCard, VSpace } from "@halo-dev/components";
import { onMounted, ref } from "vue";
import type { Post } from "@halo-dev/api-client";
import { apiClient } from "@halo-dev/admin-shared";
import { formatDatetime } from "@/utils/date";
const posts = ref<Post[]>([] as Post[]);
@ -46,7 +47,7 @@ onMounted(handleFetchPosts);
<div>
<time class="text-sm text-gray-500">
{{ post.metadata.creationTimestamp }}
{{ formatDatetime(post.metadata.creationTimestamp) }}
</time>
</div>
</div>

@ -9,6 +9,7 @@ import {
import { toRefs } from "vue";
import { usePluginLifeCycle } from "../composables/use-plugin";
import type { Plugin } from "@halo-dev/api-client";
import { formatDatetime } from "@/utils/date";
const props = withDefaults(
defineProps<{
@ -101,11 +102,8 @@ const { isStarted, changeStatus, uninstall } = usePluginLifeCycle(plugin);
<span class="hidden text-sm text-gray-500 sm:block">
{{ plugin?.spec.version }}
</span>
<time
class="hidden text-sm text-gray-500 sm:block"
datetime="2020-01-07"
>
{{ plugin?.metadata.creationTimestamp }}
<time class="hidden text-sm text-gray-500 sm:block">
{{ formatDatetime(plugin?.metadata.creationTimestamp) }}
</time>
<div
v-permission="['system:plugins:manage']"

@ -17,6 +17,7 @@ import type { Role } from "@halo-dev/api-client";
import { apiClient } from "@halo-dev/admin-shared";
import { roleLabels } from "@/constants/labels";
import { rbacAnnotations } from "@/constants/annotations";
import { formatDatetime } from "@/utils/date";
const roles = ref<Role[]>([]);
const editingModal = ref<boolean>(false);
@ -217,7 +218,7 @@ onMounted(() => {
</a>
<VTag> 系统保留</VTag>
<time class="text-sm text-gray-500">
{{ role.metadata.creationTimestamp }}
{{ formatDatetime(role.metadata.creationTimestamp) }}
</time>
<span
v-permission="['system:roles:manage']"

@ -18,6 +18,7 @@ import { onMounted, ref } from "vue";
import { apiClient } from "@halo-dev/admin-shared";
import type { User, UserList } from "@halo-dev/api-client";
import { rbacAnnotations } from "@/constants/annotations";
import { formatDatetime } from "@/utils/date";
const checkAll = ref(false);
const editingModal = ref<boolean>(false);
@ -313,8 +314,8 @@ onMounted(() => {
{{ role }}
</VTag>
</div>
<time class="text-sm text-gray-500" datetime="2020-01-07">
{{ user.metadata.creationTimestamp }}
<time class="text-sm text-gray-500">
{{ formatDatetime(user.metadata.creationTimestamp) }}
</time>
<span
v-permission="['system:users:manage']"

Loading…
Cancel
Save