elm-date-format icon indicating copy to clipboard operation
elm-date-format copied to clipboard

Add non-zero padded month of year

Open Janiczek opened this issue 6 years ago • 2 comments

In the format directives there is one missing: a space-padded (or non-padded) month number (July -> 7 or 7). I'd find that useful :)

Janiczek avatar Mar 22 '18 14:03 Janiczek

First, space-padding and no padding are different. Second, is there prior art with format strings for what escape sequence should represent one of those?

mgold avatar Mar 23 '18 03:03 mgold

Prior art:

  • http://www.cplusplus.com/reference/ctime/strftime/
  • http://php.net/manual/en/function.strftime.php These don't have space-padded or non-padded month numbers.

But there's Ruby:

  • https://apidock.com/ruby/DateTime/strftime which allows for %-m.
-  don't pad a numerical output.
_  use spaces for padding.
0  use zeros for padding.
^  upcase the result string.
#  change case.
:  use colons for %z.

I understand there's a difference in space padding and no padding, but in HTML context that usually doesn't matter (unless you do white-space: pre or something similar). I'm OK with any of the two options, but would probably use non-padded more often.

Janiczek avatar Mar 23 '18 08:03 Janiczek