wanasit / chrono

A natural language date parser in Javascript
MIT License
4.6k stars 341 forks source link

_tag field is missing in V2 #569

Closed handofthecode closed 1 month ago

handofthecode commented 2 months ago

V1 has a helpful tags field. V2 has _tags, but it's empty. V1: "tags": { "ENSlashDateFormatParser": true }, V2: "_tags": {},

Repro steps:

const conditionedDate1 = "13-1-2022"; const result = chrono.parse(conditionedDate1);

V1 results: [ { "ref": "2024-09-13T19:43:53.133Z", "index": 0, "text": "13-1-2022", "tags": { "ENSlashDateFormatParser": true }, "start": { "knownValues": { "day": 13, "month": 1, "year": 2022 }, "impliedValues": { "hour": 12, "minute": 0, "second": 0, "millisecond": 0 } } } ]

V2 results: [ { "reference": { "instant": "2024-09-13T19:42:06.339Z" }, "refDate": "2024-09-13T19:42:06.339Z", "index": 0, "text": "13-1-2022", "start": { "_tags": {}, "reference": { "instant": "2024-09-13T19:42:06.339Z" }, "knownValues": { "day": 13, "month": 1, "year": 2022 }, "impliedValues": { "hour": 12, "minute": 0, "second": 0, "millisecond": 0 } }, "end": null } ]

wanasit commented 1 month ago

Thanks for reporting.

Note that, for Chrono v2, the debug tags are (re-)introduced in recent v2.7.0. More tags will be added incrementally.

The "parser/SlashDateFormatParser" is added in 6646c75a917ce6377e6a04f31e95fe9ecf679030. Please let me know if you need any specific result, parser, or condition to be tagged.