git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 0/2] More ISO-8601 support

From
Đoàn Trần Công Danh <congdanhqx@gmail.com>
Date
Apr 14, 2020, 09:31 UTC
Message-ID
<cover.1586856398.git.congdanhqx@gmail.com>
In-Reply-To
<20200414000324.GA2751707@camp.crustytoothpaste.net>
On 2020-04-14 00:03:24+0000, "brian m. carlson" <sandals@crustytoothpaste.net> wrote:
> git-commit(1) claims we support ISO 8601 format.  However, our
> approxidate code misparses some dates with fractional seconds.

We have never fully supported ISO-8601, those representation are perfectly valid ISO-8601 (for 2020-04-14) but it would require more code to parse correctly, perhap "tm_wday" and "tm_yday", and mktime may help.

	2020-W16-2
	--04-14
	2020-105

I don't think not many people interested in those formats. If someone really need them, we can get back to them later.

Show 21 quoted lines
> 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

If we plan on supporting more format from ISO-8601, these 2 patches can be used.

Đoàn Trần Công Danh (2):
  date.c: allow fractional second part of ISO-8601
  date.c: allow compact version of ISO-8601 datetime
 date.c          | 20 ++++++++++++++++++++
 t/t0006-date.sh |  4 ++++
 2 files changed, 24 insertions(+)
-- 
2.26.0.485.g518673e55f
Previous: brian m. carlsonNext: Đoàn Trần Công Danh
Message 2 of 49 in “Mishandling of fractional seconds in ISO 8601 format”
  1. brian m. carlsonApr 14, 2020
  2. 0/2 More ISO-8601 supportĐoàn Trần Công Danh, Apr 14, 2020
  3. 1/2 date.c: allow fractional second part of ISO-8601Đoàn Trần Công Danh, Apr 14, 2020
  4. Jeff KingApr 14, 2020
  5. Danh DoanApr 15, 2020
  6. Jeff KingApr 14, 2020
  7. brian m. carlsonApr 14, 2020
  8. Danh DoanApr 15, 2020
  9. 2/2 date.c: allow compact version of ISO-8601 datetimeĐoàn Trần Công Danh, Apr 14, 2020
  10. Jeff KingApr 14, 2020
  11. Danh DoanApr 15, 2020
  12. Junio C HamanoApr 15, 2020
  13. Jeff KingApr 15, 2020
  14. Junio C HamanoApr 15, 2020
  15. Danh DoanApr 16, 2020
  16. brian m. carlsonApr 14, 2020
  17. 0/2 More ISO-8601 supportĐoàn Trần Công Danh, Apr 15, 2020
  18. 1/2 date.c: skip fractional second part of ISO-8601Đoàn Trần Công Danh, Apr 15, 2020
  19. Torsten BögershausenApr 15, 2020
  20. Danh DoanApr 16, 2020
  21. 2/2 date.c: allow compact version of ISO-8601 datetimeĐoàn Trần Công Danh, Apr 15, 2020
  22. 0/2 More ISO-8601 supportĐoàn Trần Công Danh, Apr 22, 2020
  23. 1/2 date.c: skip fractional second part of ISO-8601Đoàn Trần Công Danh, Apr 22, 2020
  24. Junio C HamanoApr 22, 2020
  25. Danh DoanApr 23, 2020
  26. Junio C HamanoApr 23, 2020
  27. Philip OakleyApr 23, 2020
  28. Danh DoanApr 24, 2020
  29. Junio C HamanoApr 24, 2020
  30. Philip OakleyApr 24, 2020
  31. Philip OakleyApr 24, 2020
  32. 2/2 date.c: allow compact version of ISO-8601 datetimeĐoàn Trần Công Danh, Apr 22, 2020
  33. Junio C HamanoApr 22, 2020
  34. Danh DoanApr 23, 2020
  35. 0/4 More ISO-8601 supportĐoàn Trần Công Danh, Apr 23, 2020
  36. 1/4 date.c: s/is_date/set_date/Đoàn Trần Công Danh, Apr 23, 2020
  37. Junio C HamanoApr 23, 2020
  38. 2/4 date.c: validate and set time in a helper functionĐoàn Trần Công Danh, Apr 23, 2020
  39. Junio C HamanoApr 23, 2020
  40. Danh DoanApr 24, 2020
  41. Junio C HamanoApr 24, 2020
  42. 3/4 date.c: skip fractional second part of ISO-8601Đoàn Trần Công Danh, Apr 23, 2020
  43. Junio C HamanoApr 23, 2020
  44. 4/4 date.c: allow compact version of ISO-8601 datetimeĐoàn Trần Công Danh, Apr 23, 2020
  45. 0/4 More ISO-8601 supportĐoàn Trần Công Danh, Apr 24, 2020
  46. 1/4 date.c: s/is_date/set_date/Đoàn Trần Công Danh, Apr 24, 2020
  47. 2/4 date.c: validate and set time in a helper functionĐoàn Trần Công Danh, Apr 24, 2020
  48. 3/4 date.c: skip fractional second part of ISO-8601Đoàn Trần Công Danh, Apr 24, 2020
  49. 4/4 date.c: allow compact version of ISO-8601 datetimeĐoàn Trần Công Danh, Apr 24, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.