Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/RoyalIcing/soonerorlater
JavaScript parser of natural language time periods
https://github.com/RoyalIcing/soonerorlater
date-parser javascript natural-language time-parsing typescript
Last synced: about 2 months ago
JSON representation
JavaScript parser of natural language time periods
- Host: GitHub
- URL: https://github.com/RoyalIcing/soonerorlater
- Owner: RoyalIcing
- License: mit
- Created: 2021-02-20T04:51:22.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-23T22:19:03.000Z (over 1 year ago)
- Last Synced: 2024-04-20T19:43:10.094Z (5 months ago)
- Topics: date-parser, javascript, natural-language, time-parsing, typescript
- Language: TypeScript
- Homepage:
- Size: 180 KB
- Stars: 91
- Watchers: 4
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
- awesome-list - soonerorlater
README
## Install
```console
npm add soonerorlater
```-
-
-## Examples
```javascript
import { parse } from "soonerorlater";parse('Every Wednesday');
/*
{
repeats: 'weekly',
weekdays: new Set(['wednesday'])
}
*/parse('Mondays and Thursdays at 9:30am to 10:30am');
/*
{
repeats: 'weekly',
weekdays: new Set(['monday', 'thursday']),
startTime: { hours: 9, minutes: 30 },
endTime: { hours: 10, minutes: 30 }
}
*/
```## Notes
- Uses the library [parcook](https://github.com/RoyalIcing/parcook) for parsing.
- TODO: support standard representations as result