wanasit / chrono

A natural language date parser in Javascript
MIT License
4.61k stars 339 forks source link

`MM/DD/YYYY-HH:MM PM` format not working #467

Open vicenteguedes opened 2 years ago

vicenteguedes commented 2 years ago

I use chrono-node version 2.4.1. The test I'm running for this specific time string is returning a weird result. Parsing 06/16/2022-05:00 PM returns 2022-08-24T01:22:00.000Z.

The code I use is

const res = chrono.parseDate("06/16/2022-05:00 PM")

and this res object returns

[
        {
            "reference": {
                "instant": "2022-08-23T08:44:00.800Z"
            },
            "refDate": "2022-08-23T08:44:00.800Z",
            "index": 6,
            "text": "2022-05:00 PM",
            "start": {
                "reference": {
                    "instant": "2022-08-23T08:44:00.800Z"
                },
                "knownValues": {
                    "hour": 20,
                    "minute": 22,
                    "meridiem": 1
                },
                "impliedValues": {
                    "day": 23,
                    "month": 8,
                    "year": 2022,
                    "second": 0,
                    "millisecond": 0
                }
            },
            "end": {
                "reference": {
                    "instant": "2022-08-23T08:44:00.800Z"
                },
                "knownValues": {
                    "hour": 17,
                    "minute": 0,
                    "meridiem": 1
                },
                "impliedValues": {
                    "day": 24,
                    "month": 8,
                    "year": 2022,
                    "second": 0,
                    "millisecond": 0
                }
            }
        }
    ]