Is there a library for entering text values in an HTML text box which are then converted into a date? For example, typing "Next Monday" puts next Monday's date in, "Next month" puts today's date + 1 month, "+4" puts today's date + 4 days, etc.
Asked
Active
Viewed 38 times
0
-
Maybe this can help: https://stackoverflow.com/questions/34979051/find-next-instance-of-a-given-weekday-ie-monday-with-moment-js – CaeSea Nov 06 '19 at 14:33
1 Answers
2
You might want to consider moment.js, which solves this sort of problem.
For natural language date-parsing, check out chrono.js.
chrono.parseDate(document.getElementById("my-input").value)
For an input value of "next week"
, this will return today's date plus seven days, in a Date
type.

j6m8
- 2,261
- 2
- 26
- 34