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

@ -9,6 +9,7 @@ import {
import { toRefs } from "vue"; import { toRefs } from "vue";
import { usePluginLifeCycle } from "../composables/use-plugin"; import { usePluginLifeCycle } from "../composables/use-plugin";
import type { Plugin } from "@halo-dev/api-client"; import type { Plugin } from "@halo-dev/api-client";
import { formatDatetime } from "@/utils/date";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
@ -101,11 +102,8 @@ const { isStarted, changeStatus, uninstall } = usePluginLifeCycle(plugin);
<span class="hidden text-sm text-gray-500 sm:block"> <span class="hidden text-sm text-gray-500 sm:block">
{{ plugin?.spec.version }} {{ plugin?.spec.version }}
</span> </span>
<time <time class="hidden text-sm text-gray-500 sm:block">
class="hidden text-sm text-gray-500 sm:block" {{ formatDatetime(plugin?.metadata.creationTimestamp) }}
datetime="2020-01-07"
>
{{ plugin?.metadata.creationTimestamp }}
</time> </time>
<div <div
v-permission="['system:plugins:manage']" 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 { apiClient } from "@halo-dev/admin-shared";
import { roleLabels } from "@/constants/labels"; import { roleLabels } from "@/constants/labels";
import { rbacAnnotations } from "@/constants/annotations"; import { rbacAnnotations } from "@/constants/annotations";
import { formatDatetime } from "@/utils/date";
const roles = ref<Role[]>([]); const roles = ref<Role[]>([]);
const editingModal = ref<boolean>(false); const editingModal = ref<boolean>(false);
@ -217,7 +218,7 @@ onMounted(() => {
</a> </a>
<VTag> 系统保留</VTag> <VTag> 系统保留</VTag>
<time class="text-sm text-gray-500"> <time class="text-sm text-gray-500">
{{ role.metadata.creationTimestamp }} {{ formatDatetime(role.metadata.creationTimestamp) }}
</time> </time>
<span <span
v-permission="['system:roles:manage']" v-permission="['system:roles:manage']"

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

Loading…
Cancel
Save