Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat(core): set journal's really created time (#5968)

Cats Juice358e1e99c5c2
diff --git a/packages/frontend/core/src/hooks/use-journal.ts b/packages/frontend/core/src/hooks/use-journal.ts
index c169a6a96e..695456eac0 100644
--- a/packages/frontend/core/src/hooks/use-journal.ts
+++ b/packages/frontend/core/src/hooks/use-journal.ts
@@ -31,11 +31,17 @@ export const useJournalHelper = (workspace: BlockSuiteWorkspace) => {
*/
const _createJournal = useCallback(
(maybeDate: MaybeDate) => {
- const title = dayjs(maybeDate).format(JOURNAL_DATE_FORMAT);
+ const day = dayjs(maybeDate);
+ const title = day.format(JOURNAL_DATE_FORMAT);
const page = bsWorkspaceHelper.createDoc();
// set created date to match the journal date
page.workspace.setDocMeta(page.id, {
- createDate: dayjs(maybeDate).toDate().getTime(),
+ createDate: dayjs()
+ .set('year', day.year())
+ .set('month', day.month())
+ .set('date', day.date())
+ .toDate()
+ .getTime(),
});
initEmptyPage(page, title);
adapter.setJournalPageDateString(page.id, title);