super-calendar
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

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

Package Sidebar

Install

npm i super-calendar

Weekly Downloads

4

Version

1.0.0

License

MIT

Unpacked Size

70.6 kB

Total Files

9

Last publish

Collaborators

  • karan69