Не подтверждена Коммит 358e1e99 создал по автору Cats Juice's avatar Cats Juice
Просмотр файлов

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

closes #5958;

This makes the creation date of the journal correspond to the date, and the creation time is the real creation time.
владелец 3fcbfe4d
...@@ -31,11 +31,17 @@ export const useJournalHelper = (workspace: BlockSuiteWorkspace) => { ...@@ -31,11 +31,17 @@ export const useJournalHelper = (workspace: BlockSuiteWorkspace) => {
*/ */
const _createJournal = useCallback( const _createJournal = useCallback(
(maybeDate: MaybeDate) => { (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(); const page = bsWorkspaceHelper.createDoc();
// set created date to match the journal date // set created date to match the journal date
page.workspace.setDocMeta(page.id, { 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); initEmptyPage(page, title);
adapter.setJournalPageDateString(page.id, title); adapter.setJournalPageDateString(page.id, title);
......
Поддерживает Markdown
0% или .
You are about to add 0 people to the discussion. Proceed with caution.
Сначала завершите редактирование этого сообщения!
Пожалуйста, зарегистрируйтесь или чтобы прокомментировать