Repository navigation
Conversation
`date -d` (and `touch -d`, `find -newermt`, which share the parser) only took ISO dates with full seconds and no zone. It now also reads `YYYY-MM-DD HH:MM`, an optional fraction of a second, and a trailing `UTC`/`GMT`, `Z` or numeric offset (`+0200`, `+02:00`, `-05`), which covers git's `%ci` format.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
date -dnow accepts ISO date-times without seconds and with a zone.touch -dandfind -newermtshare the parser and gain the same forms.YYYY-MM-DD HH:MM(withTor a space), and an optional fraction after the secondsUTC/GMT,Z, or a numeric offset (+0200,+02:00,-05), so git's%cioutput parsesThe change is a few more chrono formats next to the existing ones; chrono validates the fields and the offset range.
Why
Only
YYYY-MM-DDandYYYY-MM-DD HH:MM:SSwithout a zone were accepted, so common inputs such as a minute-precision timestamp, a UTC log line or a git commit date failed withinvalid date.Before / After
Every After line matches GNU date 9.12. Compared with GNU on 31 date-time inputs in UTC and America/Los_Angeles: the only differences are rare forms this still rejects (a comma fraction
14:30:15,5, an exact-2400offset,2026-10-08Z), and12:30:60, which bashkit already accepted before this change.Risk
Checklist
date.test.sh, three rows in the GNUdatedifferential test