Summary
When parsing a date string that contains the year 3000, chrono-node returns an incorrect result (wrong year and/or wrong date).
Steps to reproduce
Sandbox Link : https://codesandbox.io/p/sandbox/natural-time-string-parsing-with-chrono-node-1w0no
Reproducer:
import "./styles.css";
import * as chrono from "chrono-node";
const dateparse = (dateString) => {
const parsedDate = chrono.parse(dateString);
if (parsedDate.length > 0) {
return parsedDate[0].start.date().toLocaleDateString();
} else {
return "error";
}
};
export default function App() {
const times = ["Jan 1 2999", "Jan 1 3000, 930"];
return (
<dl className="App">
{times.map((time) => (
<>
<dt>{time}</dt>
<dd>= {dateparse(time)}</dd>
<br />
</>
))}
</dl>
);
}
Expected behavior
I expected the parsed result to represent 3000-01-01T00:00:00 in my local timezone (or the equivalent UTC value).
Environment
chrono-node version: 2.3.4
Node.js version: v20.14.0
Platform: Windows / macOS / Linux (include version)
Locale / language: e.g. en, en_GB, etc.
Timezone: e.g. Asia/Kolkata
Summary
When parsing a date string that contains the year 3000, chrono-node returns an incorrect result (wrong year and/or wrong date).
Steps to reproduce
Sandbox Link : https://codesandbox.io/p/sandbox/natural-time-string-parsing-with-chrono-node-1w0no
Reproducer:
Expected behavior
I expected the parsed result to represent
3000-01-01T00:00:00in my local timezone (or the equivalent UTC value).Environment
chrono-node version: 2.3.4
Node.js version: v20.14.0
Platform: Windows / macOS / Linux (include version)
Locale / language: e.g. en, en_GB, etc.
Timezone: e.g. Asia/Kolkata