]> Cypherpunks.ru repositories - gostls13.git/commit
time: clarify documentation for allowed formats and add tests to prove them
authorMarcus Watkins <marwatk@marcuswatkins.net>
Thu, 21 Jul 2022 18:38:51 +0000 (12:38 -0600)
committerGopher Robot <gobot@golang.org>
Mon, 25 Jul 2022 16:15:08 +0000 (16:15 +0000)
commitdcea1ee6e3b805c2967950d48fddff5c69d2af85
tree3301d803808eb25bf9538ef32a85a9ce7753888d
parent37c8112b825a2c60d1b3776c0b4f4c643391d490
time: clarify documentation for allowed formats and add tests to prove them

The existing documentation for the time.Layout const states "Only these values
are recognized", but then doesn't include the numeric forms for month leading to
ambiguity and assumptions that may not be true. It's unclear, for example,
that space padding is only available for day of the month.

Finally I add tests to show the behaviors in specific scenarios.

Change-Id: I4e08a14834c17b6bdf3b6b47d39dafa8c1a138fb
Reviewed-on: https://go-review.googlesource.com/c/go/+/418875
Reviewed-by: Rob Pike <r@golang.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Run-TryBot: Ian Lance Taylor <iant@golang.org>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Ian Lance Taylor <iant@google.com>
src/time/format.go
src/time/format_test.go