Mishandling of fractional seconds in ISO 8601 format

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



git-commit(1) claims we support ISO 8601 format.  However, our
approxidate code misparses some dates with fractional seconds.

Reproduction:

  git init foo
  cd foo
  echo abc > abc.txt
  git add .
  git commit --date="2020-04-03T12:43:55.019-04:00”

This should produce Fri Apr 3 12:43:55 2020 -0400, but actually produces
Sun Apr 19 12:43:55 2020 +0000 (at least on my system, which uses UTC).
Note the different date, which is 16 days away from what is expected.

Since we claim to support ISO 8601, we need to either reject fractional
seconds with an error, or accept and ignore them.  If what we really
support is RFC 3339 (which I suspect it is), we need to do the latter,
since that profile explicitly permits them in the syntax, as well as
update the documentation accordingly.

This was originally reported at
https://stackoverflow.com/questions/61193896/how-does-git-parse-date-string/61197722.
I don't plan to send a patch for this right now, but I wanted to make
sure it was reported to the list.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux