Parses natural language to date schedules.

Overview

Parrot

DateParrot

DateParrot parses natural language into a unified schedule object or ISO date.

This package is in a very early stage and not yet production ready.

Open Playground

Installation

npm install date-parrot

Usage

import { parseDate } from 'date-parrot'

parseDate('lets go out tomorrow')

// =>
// {
//   date: [TOMORROW_AS_ISO_STRING],
//   match: {
//     index: 12,
//     length: 8,
//     text: 'tomorrow',
//   },
// }
import { parseSchedule } from 'date-parrot'

parseSchedule('every second day')

// =>
// {
//   schedule: {
//     repeatFrequency: 'P2D',
//     startDate: '[NOW_AS_ISO_STRING]',
//   },
//   match: {
//     index: 0,
//     length: 16,
//     text: 'every second day',
//   },
// }
import { parseSchedule } from 'date-parrot'

parseSchedule('eat donuts on every 3rd friday')

// =>
// {
//   schedule: {
//     repeatFrequency: 'P1W',
//     startDate: '[NEXT_FRIDAY_AS_ISO_STRING]',
//   },
//   match: {
//     index: 11,
//     length: 16,
//     text: 'every 3rd friday',
//   },
// }

Localization

By default DateParrot only parses english but you can add support for other languages by adding a locales property to the config of the parser functions.

It takes an array of locale identifiers (e.g. ['en', 'de']).

import { parseDate } from 'date-parrot'

parseDate('lass uns morgen ausgehen', { locales: ['de'] })

// =>
// {
//   date: [TOMORROW_AS_ISO_STRING],
//   match: {
//     index: 9,
//     length: 6,
//     text: 'morgen',
//   },
// }
You might also like...

i18n-language.js is Simple i18n language with Vanilla Javascript

i18n-language.js i18n-language.js is Simple i18n language with Vanilla Javascript Write by Hyun SHIN Demo Page: http://i18n-language.s3-website.ap-nor

Jul 12, 2022

When a person that doesn't know how to create a programming language tries to create a programming language

When a person that doesn't know how to create a programming language tries to create a programming language

Kochanowski Online Spróbuj Kochanowskiego bez konfiguracji projektu! https://mmusielik.xyz/projects/kochanowski Instalacja Stwórz nowy projekt przez n

Dec 4, 2022

Write "hello world" in your native language, code "hello world" in your favorite programming language!

Hello World, All languages! 🌎 📌 Write "hello world" in your native language, code "hello world" in your favorite language! #hacktoberfest2022 How to

Dec 13, 2022

A JavaScript lib with more functions for the normal Date class.

A JavaScript lib with more functions for the normal Date class.

Jan 26, 2022

Remarkable is a simple extension that automatically keeps your bookmarks clean & up-to-date.

Remarkable is a simple extension that automatically keeps your bookmarks clean & up-to-date.

Remarkable Remarkable is a simple extension that automatically keeps your bookmarks clean & up-to-date. Installation (Other browsers coming soon - sor

Dec 21, 2022

A NEXT.js stock lookup app to find up-to-date data about a stock using Finnhub's API

Stock ticker challenge A NEXT.js stock lookup app to find up-to-date data about a stock using Finnhub's API. Thought Process I decided to make a searc

May 30, 2022

A blazingly fast CDN, at par and up-to-date with modern web technologies

A blazingly fast CDN, at par and up-to-date with modern web technologies

Sep 22, 2022

Quick access to view the current time and date in Ethiopian calendar.

Ethiopian-Current-time-chrome-extension Quick access to view the current time and date in Ethiopian calendar. steps to follow:- Extract the zip folder

Aug 26, 2022

A simple extension that shows how many days a user has left until the date of the deadline

A simple extension that shows how many days a user has left until the date of the deadline

A simple extension that shows how many days a user has left until the date of the deadline

Nov 18, 2022
Owner
Jörg Bayreuther
I like creating things. I care about clean code and a clean user experience. And weirdly enough i am kinda into testing.
Jörg Bayreuther
Vesting contract with multiple beneficiaries, tokens, and lock schedules.

⚠️ This code has not been audited, use at your own risk Vesting Contract This contract handles the vesting of ERC20 tokens for multiple beneficiaries.

DeFi Wonderland 5 Mar 14, 2022
Semantic is a UI component framework based around useful principles from natural language.

Semantic UI Semantic is a UI framework designed for theming. Key Features 50+ UI elements 3000 + CSS variables 3 Levels of variable inheritance (simil

Semantic Org 50.3k Jan 7, 2023
this is a single-page web application. we built a book website where the user can add , remove and display books. we used modules to implement these functionalities. also, we used the Date class to display the date and time.

Awsome Books In this Project, we have built A Books websites. Built With ?? HTML CSS javascript Git & Github Live Demo Here you can find the live Demo

Nedjwa Bouraiou 10 Aug 3, 2022
This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my initial appointment date. It doesn't handle rescheduling.

US-visa-appointment-notifier This is just a script I put together to check and notify me via email (MailGun) when there's an earlier date before my in

Theophilus Omoregbee 13 Jan 4, 2023
Automaticly parses known pocket ips patch resources, scans folders or zip files for matching roms and applies the patches.

Pocket Automaton Automaticly parses known pocket ips patch resources, scans folders or zip files for matching roms and applies the patches. Usage pock

null 3 Nov 27, 2022
CLI utility that parses argv, loads your specified file, and passes the parsed argv into your file's exported function. Supports ESM/TypeScript/etc out of the box.

cleffa CLI tool that: Parses argv into an object (of command-line flags) and an array of positional arguments Loads a function from the specified file

Lily Scott 9 Mar 6, 2022
Discovers and parses news, blog and podcast posts from any website

post-feed-reader A library to fetch news, blog or podcast posts from any site. It works by auto-discovering a post source, which can be an RSS/Atom/JS

Guilherme Chaguri 4 Mar 14, 2022
Lightweight (< 2.3kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode characters, numbers, dates, etc.

fast-natural-order-by Lightweight (< 2.3kB gzipped) and performant natural sorting of arrays and collections by differentiating between unicode charac

Shelf 5 Nov 14, 2022
ln-charts parses the output of bos accounting commands into various charts for your Lightning Node.

ln-charts ln-charts parses the output of bos accounting commands into various charts for your Lightning Node. It runs on Angular, JS, HTML, CSS, ngx-c

Steven Ellis 21 Dec 18, 2022
parses human-readable strings for JavaScript's Temporal API

?? temporal-parse What is the temporal-parse? Temporal is the next generation of JavaScript's standard Date API. It's currently proposed to TC39 (see:

Eser Ozvataf 22 Jan 2, 2023