text to date extractor in arabic and english
npm install date-extractor``bash`
npm install date-parser-package
javascript
import DateParser, { DateTime } from "date-parser-package";
`$3
`javascript
const dateParser = new DateParser("بعد 3 ايام");
const date = await dateParser.execute();
console.log(date);
`$3
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.