Bug Fixes
-
relative dates roll over month ends like Git, instead of clamping.
N months/years agonow steps down the calendar fields while keeping the
day-of-month, so a day beyond the end of the target month rolls over into
the following month, the waymktime(3)normalizes it for Git: one month
before 2026-03-31 now is 2026-03-03, no longer 2026-02-28.Count-unit pairs also apply in input order and accumulate when repeated,
both matching Git as well. -
accept the relative dates Git accepts, and read their units case-insensitively.
Five shapesapproxidate()in Git'sdate.caccepts were not accepted here.Units are now matched without regard to case, as
match_string()does. This one
produced a wrong answer rather than a rejection:2 HOURS agofell through to
the catch-all and became two seconds ago, which looks like a date rather than
an error.More than one
<count> <unit>pair is read, so2 days 3 hours agois both of
them. Git applies a unit the moment it sees one and carries on, and stopping
after the first pair would substitute a plausible-looking two days.Any byte that is neither a digit nor a letter separates the parts, because
approxidate_alpha()ends a word at the first byte that is not a letter. So
1.hour.agoand1-hour-agoread as1 hour agodoes, and a leading-is a
separator too, which is why-1 days agois one day rather than a rejection.
Note this holds for the<count> <unit>shapes handled here;approxidate_digit()
does look at the byte after a digit run, which is how2008.12.24stays a date.Counts may be spelled out, from
onetoten, as they are innumber_name[].
zerois not among them, since Git's lookup starts at one.lastis a count of
one, solast weekresolves.The trailing
agois not required, because Git applies a unit as soon as it sees
one; even2 days henceresolves into the past there. It is still what permits an
unknown unit to count as seconds, though, or1745582210 +0200would parse as a
count in the unknown unit0200and never reachparse_raw().Seven entries are added to the baseline, so these record Git's own answers. The
comment claiming Git reads an unknown unit as seconds is corrected: it does not,
and leaves the count pending, where it stands in for a field of the date itself.Not addressed:
noon,midnight,tea,AMandPMare in Git'sspecial[]
table and still rejected here. They resolve against the local time zone, and this
parser deliberately works in UTC. -
accept the '@' prefix on epoch dates, like Git does
parse()is documented as parsing any time that Git can parse, and@is the
one prefix Git checks before anything else inparse_date_basic(). Two paths
reach a timestamp there:@<seconds> ±HHMMis taken by that fast path for any
value, while a bare@<seconds>is skipped as an unmatched byte and recognised
only by the epoch heuristic that starts at 100000000.Both forms were rejected here even though the underlying
1660874655 +0800and
1234567890formats already parse, so the prefix is stripped and those parsers
reused.Also corrects the relative-date documentation, which advertised
1 hour from nowalthough onlynow,today,yesterdayand<n> <unit> agoare
understood.
Bug Fixes (BREAKING)
- represent now in
parse(... ,now)as timezone-aware instant.
This allows time computation to be timezone aware, just like in Git.
Commit Statistics
- 12 commits contributed to the release over the course of 38 calendar days.
- 38 days passed between releases.
- 4 commits were understood as conventional.
- 1 unique issue was worked on: #2909
Commit Details
view details
- #2909
- Relative dates roll over month ends like Git, instead of clamping. (08de71a)
- Uncategorized
- Update manifests prior to release (ebe9095)
- Merge pull request #2905 from GitoxideLabs/various-improvements (f3bbfad)
- Adapt to changes in
gix-testtools(0cbe539) - Merge pull request #2910 from codeAnqiang-ma/fix/relative-date-month-rollover (566fea1)
- Represent now in
parse(... ,now)as timezone-aware instant. (0e7f722) - Review (1a7e5ed)
- Merge pull request #2889 from ameyypawar/date-at-epoch (bde37c1)
- Review (a094c4e)
- Accept the relative dates Git accepts, and read their units case-insensitively. (1ebbd8c)
- Accept the '@' prefix on epoch dates, like Git does (414dfeb)
- Merge pull request #2714 from GitoxideLabs/fix-credentials-parsing (cf3053a)