{"_id":"@benjypng/logseq-dateutils","_rev":"4-584e49d5d7e34f7605b595d4fb6cf235","name":"@benjypng/logseq-dateutils","dist-tags":{"latest":"3.0.1"},"versions":{"2.1.2":{"name":"@benjypng/logseq-dateutils","version":"2.1.2","keywords":["logseq","scheduled","deadline","date","utilities"],"author":{"name":"hkgnp"},"license":"MIT","_id":"@benjypng/logseq-dateutils@2.1.2","maintainers":[{"name":"hkgnp","email":"ben@pngs.cc"}],"homepage":"https://github.com/benjypng/logseq-dateutils#readme","bugs":{"url":"https://github.com/benjypng/logseq-dateutils/issues"},"dist":{"shasum":"85dff1e8ba2c32da3fe76a7ed041d0c47b4748c7","tarball":"https://registry.npmjs.org/@benjypng/logseq-dateutils/-/logseq-dateutils-2.1.2.tgz","fileCount":7,"integrity":"sha512-izch6OrnrLsKk0Nkha4QhGF8cUjlyTggmkIm8D1t/KLOi2m4B7TAixuU28al/XiZ5G4OdCA9uM79VbRa0hOB/w==","signatures":[{"sig":"MEYCIQCANo9kr4XJ73kiiuGS3W3YyoeVajrcnaVzoKtJEbRCggIhALq21K51NFYGi+/q/cCWq3xtPssCyac3v4jCsW2MLCla","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10408},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=12"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"a9741782be652c305a040acecc4b6f52386dd54b","release":{"branches":["main"]},"scripts":{"size":"size-limit","test":"TZ=Asia/Singapore bun test","build":"tsdown src/index.ts --format esm,cjs --dts --clean","start":"tsdown src/index.ts --format esm,cjs --dts --watch","analyze":"size-limit --why","prepare":"tsdown src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"hkgnp","email":"ben@pngs.cc"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/benjypng/logseq-dateutils.git","type":"git"},"size-limit":[{"path":"dist/index.cjs","limit":"10 KB"},{"path":"dist/index.mjs","limit":"10 KB"}],"_npmVersion":"11.6.2","description":"[:gift_heart: Sponsor this project on Github](https://github.com/sponsors/hkgnp) or [:coffee: Get me a coffee](https://www.buymeacoffee.com/hkgnp.dev) if you like this plugin!","directories":{},"sideEffects":false,"_nodeVersion":"25.2.1","dependencies":{"date-fns":"^2.30.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.22.2","@types/bun":"^1.3.0","typescript":"^5.5.3","@tsconfig/recommended":"^1.0.7","@size-limit/preset-small-lib":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/logseq-dateutils_2.1.2_1781261709558_0.10964629275802906","host":"s3://npm-registry-packages-npm-production"}},"2.1.3":{"name":"@benjypng/logseq-dateutils","version":"2.1.3","keywords":["logseq","scheduled","deadline","date","utilities"],"author":{"name":"hkgnp"},"license":"MIT","_id":"@benjypng/logseq-dateutils@2.1.3","maintainers":[{"name":"hkgnp","email":"ben@pngs.cc"}],"homepage":"https://github.com/benjypng/logseq-dateutils#readme","bugs":{"url":"https://github.com/benjypng/logseq-dateutils/issues"},"dist":{"shasum":"b888c266a67600a327838ae990bc0c353fd6d500","tarball":"https://registry.npmjs.org/@benjypng/logseq-dateutils/-/logseq-dateutils-2.1.3.tgz","fileCount":7,"integrity":"sha512-oYRj9su3WrDqjdXAX465V1UfQ2b1Lg1rIhbFMnc+X4QNfv4tUaOOr1EcpT2EiI9oLYGczLXqxCXVGlQ6g2dOYA==","signatures":[{"sig":"MEYCIQDJhuSE0NfWS7WnGoI9dqWWB1FUESgmzw0BXj3NxcYK/AIhAIOgyuSBw8ZXfXgk1TPVqc2g0Dh5mEhdgRRO9RV8fNWS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10408},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=12"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"a9741782be652c305a040acecc4b6f52386dd54b","release":{"branches":["main"]},"scripts":{"size":"size-limit","test":"TZ=Asia/Singapore bun test","build":"tsdown src/index.ts --format esm,cjs --dts --clean","start":"tsdown src/index.ts --format esm,cjs --dts --watch","analyze":"size-limit --why","prepare":"tsdown src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"hkgnp","email":"ben@pngs.cc"},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/benjypng/logseq-dateutils.git","type":"git"},"size-limit":[{"path":"dist/index.cjs","limit":"10 KB"},{"path":"dist/index.mjs","limit":"10 KB"}],"_npmVersion":"11.6.2","description":"[:gift_heart: Sponsor this project on Github](https://github.com/sponsors/hkgnp) or [:coffee: Get me a coffee](https://www.buymeacoffee.com/hkgnp.dev) if you like this plugin!","directories":{},"sideEffects":false,"_nodeVersion":"25.2.1","dependencies":{"date-fns":"^2.30.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.22.2","@types/bun":"^1.3.0","typescript":"^5.5.3","@tsconfig/recommended":"^1.0.7","@size-limit/preset-small-lib":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/logseq-dateutils_2.1.3_1781261749233_0.23178201768896556","host":"s3://npm-registry-packages-npm-production"}},"3.0.0":{"name":"@benjypng/logseq-dateutils","version":"3.0.0","keywords":["logseq","scheduled","deadline","date","utilities"],"author":{"name":"hkgnp"},"license":"MIT","_id":"@benjypng/logseq-dateutils@3.0.0","maintainers":[{"name":"hkgnp","email":"ben@pngs.cc"}],"homepage":"https://github.com/benjypng/logseq-dateutils#readme","bugs":{"url":"https://github.com/benjypng/logseq-dateutils/issues"},"dist":{"shasum":"48510eb03eccb16bdcf998d9b9ca4715c4a36939","tarball":"https://registry.npmjs.org/@benjypng/logseq-dateutils/-/logseq-dateutils-3.0.0.tgz","fileCount":7,"integrity":"sha512-KP3puqzlTM5udnxCz5MO+eoJh3XGfqX0lLlpxKeN0jKfphwoT8IxOXH8ZCF5MmWZbhQ08bK0tzRvF3lYc9RtaQ==","signatures":[{"sig":"MEQCIHpCJQ+pkXw/7pek7jHQNI3jG4jYNWsoPyXOtTPDTn+HAiB5oyfiY84Bixp9NKt0xVL9JdsU1rgZaKHJEEe+hRFb9A==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@benjypng%2flogseq-dateutils@3.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":10408},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.mts","module":"./dist/index.mjs","engines":{"node":">=12"},"exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"gitHead":"09146d7fdc8bc7baf6d9fd14ae3a7dde5c14c20b","release":{"branches":["main"]},"scripts":{"size":"size-limit","test":"TZ=Asia/Singapore bun test","build":"tsdown src/index.ts --format esm,cjs --dts --clean","start":"tsdown src/index.ts --format esm,cjs --dts --watch","analyze":"size-limit --why","prepare":"tsdown src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:29449674-57e3-41bb-8549-516e28bd41fe"}},"prettier":{"semi":true,"printWidth":80,"singleQuote":true,"trailingComma":"es5"},"repository":{"url":"git+https://github.com/benjypng/logseq-dateutils.git","type":"git"},"size-limit":[{"path":"dist/index.cjs","limit":"10 KB"},{"path":"dist/index.mjs","limit":"10 KB"}],"_npmVersion":"11.17.0","description":"[:gift_heart: Sponsor this project on Github](https://github.com/sponsors/hkgnp) or [:coffee: Get me a coffee](https://www.buymeacoffee.com/hkgnp.dev) if you like this plugin!","directories":{},"sideEffects":false,"_nodeVersion":"24.16.0","dependencies":{"date-fns":"^2.30.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.22.2","@types/bun":"^1.3.0","typescript":"^5.5.3","@tsconfig/recommended":"^1.0.7","@size-limit/preset-small-lib":"^9.0.0"},"_npmOperationalInternal":{"tmp":"tmp/logseq-dateutils_3.0.0_1781261968187_0.7108865058660865","host":"s3://npm-registry-packages-npm-production"}},"3.0.1":{"name":"@benjypng/logseq-dateutils","version":"3.0.1","type":"module","repository":{"type":"git","url":"git+https://github.com/benjypng/logseq-dateutils.git"},"publishConfig":{"access":"public"},"scripts":{"analyze":"size-limit --why","build":"tsdown src/index.ts --format esm,cjs --dts --clean","prepare":"tsdown src/index.ts --format esm,cjs --dts --clean","size":"size-limit","start":"tsdown src/index.ts --format esm,cjs --dts --watch","test":"bun test","typecheck":"tsc --noEmit"},"keywords":["logseq","scheduled","deadline","date","utilities"],"license":"MIT","author":{"name":"hkgnp"},"main":"./dist/index.cjs","module":"./dist/index.mjs","types":"./dist/index.d.mts","exports":{".":{"import":{"types":"./dist/index.d.mts","default":"./dist/index.mjs"},"require":{"types":"./dist/index.d.cts","default":"./dist/index.cjs"}}},"sideEffects":false,"release":{"branches":["main"]},"prettier":{"printWidth":80,"semi":true,"singleQuote":true,"trailingComma":"es5"},"engines":{"node":">=12"},"size-limit":[{"path":"dist/index.cjs","limit":"10 KB"},{"path":"dist/index.mjs","limit":"10 KB"}],"devDependencies":{"@size-limit/preset-small-lib":"^9.0.0","@tsconfig/recommended":"^1.0.7","@types/bun":"^1.3.0","tsdown":"^0.22.2","typescript":"^5.5.3"},"dependencies":{"date-fns":"^2.30.0"},"gitHead":"1b27330b56622d8587fd6eb66aebbd56e7b43bea","_id":"@benjypng/logseq-dateutils@3.0.1","description":"![Version](https://img.shields.io/npm/v/%40benjypng%2Flogseq-dateutils?style=flat-square&color=0969da) ![Downloads](https://img.shields.io/npm/dm/%40benjypng%2Flogseq-dateutils?style=flat-square&color=orange) ![License](https://img.shields.io/github/licen","bugs":{"url":"https://github.com/benjypng/logseq-dateutils/issues"},"homepage":"https://github.com/benjypng/logseq-dateutils#readme","_nodeVersion":"24.16.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-Lpc3cfVvenrdfcV3AWXYav6li8JiYSzwwDsFamKEC1oWFk9BMMm2flwuD3U69E477UTNBYxT01kXfSp46Zq1Aw==","shasum":"ca746c3f95efd9c6f117475e2282671ca34b9fe9","tarball":"https://registry.npmjs.org/@benjypng/logseq-dateutils/-/logseq-dateutils-3.0.1.tgz","fileCount":7,"unpackedSize":12859,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@benjypng%2flogseq-dateutils@3.0.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCHx+jkVRwT0MshgeiM9NlG7KpzZP5LrI7wZJyddDjLDAIhAOtvA3QrA5rLzfunyDyUIr7eoQAh+b2kOBx1CREPriRR"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:29449674-57e3-41bb-8549-516e28bd41fe"}},"directories":{},"maintainers":[{"name":"hkgnp","email":"ben@pngs.cc"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/logseq-dateutils_3.0.1_1781324625509_0.10415086278445918"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-12T10:55:09.358Z","modified":"2026-06-13T04:23:45.904Z","2.1.2":"2026-06-12T10:55:09.702Z","2.1.3":"2026-06-12T10:55:49.383Z","3.0.0":"2026-06-12T10:59:28.324Z","3.0.1":"2026-06-13T04:23:45.642Z"},"bugs":{"url":"https://github.com/benjypng/logseq-dateutils/issues"},"author":{"name":"hkgnp"},"license":"MIT","homepage":"https://github.com/benjypng/logseq-dateutils#readme","keywords":["logseq","scheduled","deadline","date","utilities"],"repository":{"type":"git","url":"git+https://github.com/benjypng/logseq-dateutils.git"},"description":"![Version](https://img.shields.io/npm/v/%40benjypng%2Flogseq-dateutils?style=flat-square&color=0969da) ![Downloads](https://img.shields.io/npm/dm/%40benjypng%2Flogseq-dateutils?style=flat-square&color=orange) ![License](https://img.shields.io/github/licen","maintainers":[{"name":"hkgnp","email":"ben@pngs.cc"}],"readme":"# @benjypng/logseq-dateutils\n\n![Version](https://img.shields.io/npm/v/%40benjypng%2Flogseq-dateutils?style=flat-square&color=0969da) ![Downloads](https://img.shields.io/npm/dm/%40benjypng%2Flogseq-dateutils?style=flat-square&color=orange) ![License](https://img.shields.io/github/license/benjypng/logseq-dateutils?style=flat-square)\n\n> Date utilities for developing Logseq plugins — format dates in the user's preferred date format and generate ready-to-insert `SCHEDULED:` / `DEADLINE:` lines.\n\n---\n\n## ✨ Features\n\n- **User-format aware:** Format any date according to the user's `preferredDateFormat` (e.g. from `logseq.App.getUserConfigs()`), with or without `[[page brackets]]`.\n- **Ready-made org-style lines:** Generate complete `SCHEDULED: <...>` and `DEADLINE: <...>` strings, with the time included automatically when it isn't midnight.\n- **Compact timestamps:** `yyMMdd` and `yyMMdd'T'HHmm` helpers for IDs and filenames.\n- **Dual ESM + CJS** with full TypeScript declarations for both formats.\n- **Tiny:** under 9 kB minified + gzipped including its only dependency, `date-fns`.\n\n## ⚙️ Installation\n\n```\nnpm i @benjypng/logseq-dateutils\n```\n\nImport (you may also import only selective functions for your needs):\n\n```js\nimport {\n  getDateForPage,\n  getDateForPageWithoutBrackets,\n  getDeadlineDateDay,\n  getScheduledDateDay,\n  getYYMMDDTHHMMFormat,\n  getYYMMDD,\n} from '@benjypng/logseq-dateutils';\n```\n\n## 🛠 Usage\n\n### getDateForPage or getDateForPageWithoutBrackets\n\nReturns the specified date based on the user's preferred date format. Accepts 2 arguments: a `Date` and the user's preferred date format (e.g. from `logseq.App.getUserConfigs()`). `getDateForPage` returns the date with brackets (`[[date]]`) while `getDateForPageWithoutBrackets` returns the date without the brackets.\n\n```js\nimport { getDateForPage, getDateForPageWithoutBrackets } from '@benjypng/logseq-dateutils';\n\nconst preferredDateFormat = 'MMM do, yyyy';\nconst today = new Date();\n\ngetDateForPage(today, preferredDateFormat);\n// e.g. '[[Oct 3rd, 2023]]'\n\ngetDateForPageWithoutBrackets(today, preferredDateFormat);\n// e.g. 'Oct 3rd, 2023'\n```\n\n### getScheduledDateDay\n\nReturns a complete `SCHEDULED:` line for the specified date, ready to insert into a block. The time is included only if it is not midnight.\n\n```js\nconst today = new Date();\n\nawait logseq.Editor.updateBlock(\n  uuid,\n  `A quick brown fox\n${getScheduledDateDay(today)}`\n);\n// Appends e.g. 'SCHEDULED: <2023-10-03 Tue>'\n// or 'SCHEDULED: <2023-10-03 Tue 12:35>' if a time is set\n```\n\n### getDeadlineDateDay\n\nSame as `getScheduledDateDay`, but returns a `DEADLINE:` line instead.\n\n```js\nconst today = new Date();\n\nawait logseq.Editor.updateBlock(\n  uuid,\n  `A quick brown fox\n${getDeadlineDateDay(today)}`\n);\n// Appends e.g. 'DEADLINE: <2023-10-03 Tue>'\n// or 'DEADLINE: <2023-10-03 Tue 12:35>' if a time is set\n```\n\n### getYYMMDDTHHMMFormat\n\nReturns the specified date and time in `yyMMdd'T'HHmm` format.\n\n```js\ngetYYMMDDTHHMMFormat(new Date('2023-10-03T12:35:00'));\n// '231003T1235'\n```\n\n### getYYMMDD\n\nReturns the specified date in `yyMMdd` format.\n\n```js\ngetYYMMDD(new Date('2023-10-03T12:35:00'));\n// '231003'\n```\n\n## ☕️ Support\n\nIf you find this library useful, please consider supporting the development.\n\n<div align=\"center\">\n  <a href=\"https://github.com/sponsors/benjypng\"><img src=\"https://img.shields.io/badge/Sponsor-GitHub-ea4aaa?style=for-the-badge&logo=github\" alt=\"Sponsor on Github\" /></a>&nbsp;<a href=\"https://buymeacoffee.com/hkgnp.dev\"><img src=\"https://img.shields.io/badge/Buy%20Me%20a%20Coffee-ffdd00?style=for-the-badge&logo=buy-me-a-coffee&logoColor=black\" alt=\"Buy Me a Coffee\" /></a>\n</div>\n\n## 🤝 Contributing\n\nIssues are welcome. If you find a bug, please open an issue — or join [Logseq's Discord](https://discord.gg/KpN4eHY) and look for me there. Pull requests are not accepted at the moment as I am not able to commit to reviewing them in a timely fashion.\n","readmeFilename":"README.md"}