1.3.3 • Published 10 days ago
date-extractor v1.3.3
Date Parser Package
Description
This package provides functionality to parse and manipulate dates in various formats, including relative dates and user prompts.
Installation
You can install the package via npm:
npm install date-parser-package
Usage
Importing the Package
import DateParser, { DateTime } from "date-parser-package";
Date Parsing
const dateParser = new DateParser("بعد 3 ايام");
const date = await dateParser.execute();
console.log(date);
DateTime Object
The DateTime
object returned by the DateParser
class has the following properties:
date
: String representation of the date.year
: Year of the date.quarter
: Quarter of the year.month
: Month of the year.week
: Week number of the year.day
: Day of the month.hour
: Hour of the day.prev_month_year
: Year of the previous month.prev_quarter_year
: Year of the previous quarter.prev_month
: Month of the previous month.curr_day
: Current day of the month.curr_quarter
: Current quarter of the year.last_date
: Last date of the year.day_date
: Date in the format DD/MM/YYYY.days_of_year
: Days passed in the current year.prev_quarter
: Previous quarter of the year.last_year_date
: Last year's date.prev_year
: Previous year.month_name_ar
: Month name in Arabic.month_name_en
: Month name in English.api
: Indicates if the date was obtained from an API.contains_date
: Indicates if the result contains a valid date.
Dependencies
- axios
- similarity
Contributing
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.