Merge pull request #279 from yzhe819/dev

This commit is contained in:
DIYgod 2023-04-02 21:42:42 +01:00 committed by GitHub
commit 53932b9205
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 2 deletions

View File

@ -64,7 +64,7 @@ const Post = ({
{t("ago", {
time: date.dayjs
.duration(
date.dayjs(post?.createdAt).diff(date.dayjs(), "minute"),
date.dayjs(post?.createdAt).tz().diff(date.dayjs(), "minute"),
"minute",
)
.humanize(),

View File

@ -32,5 +32,8 @@ export function useDate() {
inLocalTimezone: (date: string | Date) => {
return dayjs(date).tz().toDate()
},
inUTCTimezone: (date: string | Date) => {
return dayjs(date).utc().toDate()
},
}
}

View File

@ -179,6 +179,7 @@ export default function SubdomainEditor() {
...(visibility === PageVisibilityEnum.Draft ? {} : { pageId: pageId }),
isPost: isPost,
published,
publishedAt: getInputDatetimeValue(date.inUTCTimezone(values.publishedAt), date.dayjs.utc),
externalUrl:
(values.slug || defaultSlug) &&
`${getSiteLink({
@ -225,7 +226,7 @@ export default function SubdomainEditor() {
setValues({
title: page.data.title || "",
publishedAt: page.data.date_published,
publishedAt: getInputDatetimeValue(date.inLocalTimezone(page.data.published_at), date.dayjs),
published: !!page.data.id,
excerpt: page.data.summary?.content || "",
slug: page.data.slug || "",