npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@benjypng/logseq-dateutils

v3.0.1

Published

![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

Readme

@benjypng/logseq-dateutils

Version Downloads License

Date utilities for developing Logseq plugins — format dates in the user's preferred date format and generate ready-to-insert SCHEDULED: / DEADLINE: lines.


✨ Features

  • User-format aware: Format any date according to the user's preferredDateFormat (e.g. from logseq.App.getUserConfigs()), with or without [[page brackets]].
  • Ready-made org-style lines: Generate complete SCHEDULED: <...> and DEADLINE: <...> strings, with the time included automatically when it isn't midnight.
  • Compact timestamps: yyMMdd and yyMMdd'T'HHmm helpers for IDs and filenames.
  • Dual ESM + CJS with full TypeScript declarations for both formats.
  • Tiny: under 9 kB minified + gzipped including its only dependency, date-fns.

⚙️ Installation

npm i @benjypng/logseq-dateutils

Import (you may also import only selective functions for your needs):

import {
  getDateForPage,
  getDateForPageWithoutBrackets,
  getDeadlineDateDay,
  getScheduledDateDay,
  getYYMMDDTHHMMFormat,
  getYYMMDD,
} from '@benjypng/logseq-dateutils';

🛠 Usage

getDateForPage or getDateForPageWithoutBrackets

Returns 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.

import { getDateForPage, getDateForPageWithoutBrackets } from '@benjypng/logseq-dateutils';

const preferredDateFormat = 'MMM do, yyyy';
const today = new Date();

getDateForPage(today, preferredDateFormat);
// e.g. '[[Oct 3rd, 2023]]'

getDateForPageWithoutBrackets(today, preferredDateFormat);
// e.g. 'Oct 3rd, 2023'

getScheduledDateDay

Returns a complete SCHEDULED: line for the specified date, ready to insert into a block. The time is included only if it is not midnight.

const today = new Date();

await logseq.Editor.updateBlock(
  uuid,
  `A quick brown fox
${getScheduledDateDay(today)}`
);
// Appends e.g. 'SCHEDULED: <2023-10-03 Tue>'
// or 'SCHEDULED: <2023-10-03 Tue 12:35>' if a time is set

getDeadlineDateDay

Same as getScheduledDateDay, but returns a DEADLINE: line instead.

const today = new Date();

await logseq.Editor.updateBlock(
  uuid,
  `A quick brown fox
${getDeadlineDateDay(today)}`
);
// Appends e.g. 'DEADLINE: <2023-10-03 Tue>'
// or 'DEADLINE: <2023-10-03 Tue 12:35>' if a time is set

getYYMMDDTHHMMFormat

Returns the specified date and time in yyMMdd'T'HHmm format.

getYYMMDDTHHMMFormat(new Date('2023-10-03T12:35:00'));
// '231003T1235'

getYYMMDD

Returns the specified date in yyMMdd format.

getYYMMDD(new Date('2023-10-03T12:35:00'));
// '231003'

☕️ Support

If you find this library useful, please consider supporting the development.

🤝 Contributing

Issues are welcome. If you find a bug, please open an issue — or join Logseq's Discord 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.