[go: up one dir, main page]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🧩 logseq.Editor.getPage #10

Open
utterances-bot opened this issue Jun 15, 2023 · 1 comment
Open

🧩 logseq.Editor.getPage #10

utterances-bot opened this issue Jun 15, 2023 · 1 comment

Comments

@utterances-bot
Copy link

https://plugins-doc.logseq.com/logseq/Editor/getPage

Copy link
YU000jp commented Jun 15, 2023

Get journalDay as Date (For TypeScript)

const getJournalDayDate = (str: string): Date => new Date(
  Number(str.slice(0, 4)), //year
  Number(str.slice(4, 6)) - 1, //month 0-11
  Number(str.slice(6)) //day
);

const { journalDay } = await logseq.Editor.getCurrentPage() as PageEntity;
if (!journalDay) {
  console.error('journalDay is undefined');
  return;
}
const targetDate:Date = getJournalDayDate(String(journalDay)) as Date;

getCurrentPage() or getPage(uuid)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants