mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-11-23 01:12:16 +03:00
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.
This commit is contained in:
parent
3fcbfe4d30
commit
358e1e99c5
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user