string-datetime
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

string-datetime

Developer-friendly utilities for calculating Luxon datetimes from strings.

Usage:

import { DatetimeString, parseStringToDateTime } from "string-datetime";

// return Luxon DateTime object one day from now
const datetime = parseStringToDateTime("in 1 days");

// will not compile: string-datetime uses string templates for compile-time datetime string checking
const errorDatetime = parseStringToDateTime("in 1 daos");

Supported datetime strings:

in <number> seconds
in <number> minutes
in <number> hours
in <number> days
in <number> weeks
in <number> months
by <number> seconds
by <number> minutes
by <number> hours
by <number> days
by <number> weeks
by <number> months
<number> seconds
<number> minutes
<number> hours
<number> days
<number> weeks
<number> months
next second
next minute
next hour
next day
next week
next weekday
next weekend
next month

These will all return future datetimes at the moment

/string-datetime/

    Package Sidebar

    Install

    npm i string-datetime

    Weekly Downloads

    0

    Version

    0.1.2

    License

    none

    Unpacked Size

    7.58 kB

    Total Files

    4

    Last publish

    Collaborators

    • wyozi