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

luxon-advanced-relative-calendar

v1.0.0

Published

Documatic is a search engine for your codebase; Ask documatic a question and find relevant code snippets and insights in seconds.

Readme

Documatic Hackathon project submission

Documatic is a search engine for your codebase; Ask documatic a question and find relevant code snippets and insights in seconds.

https://www.documatic.com/ Documatic acts as a search engine for your codebase; once you describe what you're looking for, Documatic pulls up related code or documentation making it easier to find what you're looking for in seconds!

Not sitting next to each other? No problem. Ask Documatic questions of your codebase to learn and understand your code in seconds. Documatic is the team member you wish you had

Our Visual studio Code extension: https://marketplace.visualstudio.com/items?itemName=Documatic.documatic

Advanced Relative Calendar - A luxon utility

aka SussyHackatonProject

This is a small utility that allows you to get a relative date from a given date, in a more customizable and rich way. It was built on the Luxon DateTime library.

Turn this:

date.plus({ days: 8 }).toRelativeCalendar()
// => "in 1 week"

Into this:

date.plus({ days: 8 }).toRelativeCalendarAdvanced("{{[rpf]wd}} {{[at] h m}}")
// => "the next monday at 15:32"

Or even this:

date.plus({ days: 8 }).toRelativeCalendarAdvanced("The party will be {{[rpf]wd}} at {{h|f:1}} {{ampm}}, will you be coming?")
// -> "The party will be next monday at 3 PM, will you be coming?"

...in no time!

Table of contents

Installation *

npm i luxon-advanced-relative-calendar

Features

  • Easy customization of simple or ultra complex relative dates
  • Easy to learn syntax
  • Numeric filters to format numeric values
  • Smart H:M:S combo formatting
  • Support for English and Spanish locales (carefully crafted by hand 😉)

Syntax

luxon.DateTime.toRelativeCalendarAdvanced(format, [locale])

Parameters

  • format - The format string. See below for more info.
  • locale - The locale to use. Currently, there is support for English en and Spanish es. Defaults to en.

Format string

The format string is a string that contains the desired output. It is composed of tokens and text. Tokens are enclosed in double curly braces {{}} and text is everything else. Tokens are replaced by their corresponding value, and text is left as is. General format: {{[prefix]value|filter:filterArg}}

Tokens

Tokens are composed of 3 parts: prefix, value and filters. The prefix and the filter are optional, see below for a list of available prefixes and filters.

Prefixes
  • [at] - Adds the appropiate article/preposition to the value to express relativity. For example, {{[at]h}} {{ampm}} will return at 3 PM, and {{[at]wd}} will return on monday.
  • [rpf] - Acts the same as the [at] prefix, but it will return the relative past/future form of the value taking in account calendar days. For example, {{[rpf]wd}} would return yesterday, today, tomorrow or next monday depending on the date given.
Values
  • wd - The weekday name. For example, {{wd}} will return monday.
  • h - The hour. For example, {{h}} will return 15.
  • m - The minute. For example, {{m}} will return 32.
  • s - The second. For example, {{s}} will return 12.
Filters
  • |f: - fill - This filters outputs a value with a desired amount of digits by adding zeroes. For example, for a time where the hour is 3, {{h|f:1}} will return 3, and {{h|f:2}} will return 03.
Special tokens
  • {{ampm}} - This token will return AM or PM depending on the hour given. For example, {{h m}} {{ampm}} will return 3:32 PM.

Examples

DateTime.local().toRelativeCalendarAdvanced("{{[rpf]wd}} {{[at] h m}}")
// => "today at 15:32"
DateTime.local().minus({ days: 3 }).toRelativeCalendarAdvanced("Message sent {{[rpf]wd}}")
// => "Message sent this monday"
DateTime.local().plus({ days: 8 }).toRelativeCalendarAdvanced("{{[rpf]wd}} at {{m}} minutes and {{s|f:10}} seconds after {{h|f:2}} {{ampm}}")
// => "next monday at 32 minutes and 12 seconds after 03 PM"
DateTime.local().plus({ days: 8 }).toRelativeCalendarAdvanced("El estreno será {{[rpf]wd}} {{[at]h|f:2}}:{{m|f:2}} {{ampm}}", "es")
// => "El estreno será el próximo lunes a las 03:32 PM"

License

This project is licensed under the MIT License - see the LICENSE file for details

Inspiration

  • This Stackoverflow comment p.d: RIP Mr. Alexei S. 3 years have passed 😂.
  • I use luxon a lot, and I wanted to make it more customizable, specially for my language (Spanish).

Acknowledgments

  • Luxon for being such a great library.
  • Documatic for hosting this hackathon.

* This package is not yet published on npm, but it will be soon, hopefully