Parsing Arbitrary Dates in Strings with Chrono and a Web Component 0 ▲ Raymond Camden 155 days ago · 5 min read1079 words · Tech · hide · Fediverse post Yesterday I had an idea for a possible experiment using Chrome's built-in AI support - looking for "date" references in strings. So for example: "I will have my new job in 12 days". Could the AI model recognize "12 days" as a date and determine what the actual date is, assuming a reference date of now? I was about to start working on a simple POC when I thought... wait... is there already a JavaScript library for this? Of course there is. The aptly named Chrono library does just that. It can parse a string with one assumed date and return the date, so for example: import * as chrono from 'chrono-node'; chrono.parseDate('An appointment on Sep 12-13'); This returns: Sat Sep 12 2026 12:00:00 GMT-0500 (Central Daylight Time). It can also take a string and give you a parsed set of results, so for example: chrono.parse('An appointment on Sep 12-13'); /* [{ index: 18, text: 'Sep 12-13', start: ... }] */ The parse method will return one result per matched item, with the result including the… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town