I'm using the https://github.com/wanasit/chrono package and was trying to expand the functionality to include an additional abbreviation. ('m' for minutes)
You'll notice m => minutes does not exist in the mapping array found here: https://github.com/wanasit/chrono/blob/1320d7c403cb4da23a8e06d82fcff5748f552936/src/locales/en/constants.ts#L136
I tried using a custom parser but I'm not quite understanding how it works:
const custom = chrono.casual.clone();
custom.parsers.push({
pattern: () => {
return /([\b|0-9]+)(m)\b/i;
},
extract: (context, match) => {
return {
minute: match[1]
};
}
});
If I type "in 15mins" (native parsing) it adds 15 minutes to "now" (relative) If I type "in 5m" using my customer parser, it sets the times minute to 5. (absolute)
How do I make my parser work with times relative to "now"