Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

super-calendar

karannakra5MIT1.0.0TypeScript support: included

A powerful and versatile JavaScript library for converting human-friendly date inputs into date objects. Super Calendar provides date parsing, natural language date recognition, and international date support, making it easy to work with dates in a user-f

date parsing, natural language date, date conversion, user-friendly date, date utility, date manipulation, date recognition, holiday dates, date formatter, international date support, human-readable date, date string parser, time-sensitive input, date resolver, date representation, date formatting, date interpreter, custom date input, smart date conversion, date processing

readme

Super-calendar

Super-calendar is a powerful and versatile JavaScript library for converting human-friendly date inputs into date objects.

Installation

You can install Super-calendar via npm, yarn, pnpm:

npm

npm install super-calendar

yarn

yarn add super-calendar

pnpm

pnpm install super-calendar

Usage

import { parseDate } from "super-calendar";

const dateSuggestions = parseDate({ query: "monday" });

Options

/**
 * Takes a string of fallback dates, if parser is not able
 * to parse the string input these predefined string values will
 * generate dates and return in suggestions array
 * */
fallback?: string[];

/**
 * Whether to parseTime, default is true
 * */
parseTime?: boolean;

/**
 * Default hour to apply to parsed / suggested dates
 * */
hour?: number | null;


/**
 * Default minute to apply to parsed / suggested dates
 * */
minute?: number | null;

/**
 * Default second to apply to parsed / suggested dates
 * */
second?: number | null;

/**
 * Options like timezone or forwardDate for chrono node
 * */
options: chrono.ParsingOption | undefined[]

/**
 *  Reference date for chrono to improve parsing to the right date
 * */
ref?: Date | undefined;

Detailed Usage Example

Here's a more detailed usage example demonstrating different inputs:

  1. Run in root folder
pnpm pack
# or
yarn pack
# or
npm pack
  1. Install the package in example folder and run the developement server.
pnpm install
pnpm run dev
# or
yarn install
yarn run dev
# or
npm install
npm run dev

Contributing

Contributions are welcome! If you have suggestions for improvements, new features, or bug fixes, feel free to open an issue or submit a pull request. Please follow the contribution guidelines when contributing to this project.

License

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

Project Stats

Alt