Large year values are not parsed correctly

Open
#160 10 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
52/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Quiet
Tech stack
rust
Domain
backend

Research direction

Start by reproducing the large-year examples in the issue and inspect the parser entry point that handles year values. Compare the results with the GNU outputs shown; the work is done when the supported large years parse consistently and the boundary or invalid cases have coverage.

Written by the indexing model from the issue text.

Description

If the year value is larger then 9999, the parsing result is inconsistent with GNU implementation:

Input: 10000-12-31
GNU: 10000-12-31 00:00:00+00:00
parse_datetime: 0000-12-31 00:00:00+00:00

Input: 100000-12-31
GNU: 100000-12-31 00:00:00+00:00
parse_datetime: 2000-12-31 00:00:00+00:00

Input: 1000000-12-31
GNU: 1000000-12-31 00:00:00+00:00
parse_datetime: 0000-12-31 00:00:00+00:00

Input: 10000000-12-31
GNU: 10000000-12-31 00:00:00+00:00
parse_datetime: Invalid input string: cannot be parsed as a relative time

Input: 2147485547-12-31
GNU: 2147485547-12-31 00:00:00+00:00 // This is the max value supported by GNU
parse_datetime: Invalid input string: cannot be parsed as a relative time
Dominant language
Rust
Stars
37
Forks
39
Avg merge
17h 48m
Merged PRs (30d)
8

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from uutils/parse_datetime

All issues in uutils/parse_datetime

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.