Skip to content

strftime precision against combinated formats (ex. %F, %r, ...) #6169

@dmikurube

Description

@dmikurube

Time.strftime has some combinated formats, such as %F equal to %Y-%m-%d, and %r equal to %I:%M:%S %p.

Users can apply options even for those combinated formats, for example %20F. But the behavior is different between CRuby and JRuby.

Environment Information

  • Confirmed with JRuby 9.1.15.0 and 9.2.10.0.
  • Mac OS X 10.13. (The OS does not sound related, though.)

Expected Behavior

This is CRuby's behavior. (2.4, 2.5, 2.6, 2.7)

irb(main):001:0> require 'time'
=> true
irb(main):002:0> Time.now.strftime("%20F")
=> "          2020-04-06"

Actual Behavior

JRuby is working like :

irb(main):001:0> require 'time'
=> true
irb(main):002:0> Time.now.strftime("%20F")
=> "00000000000000002020-04-06"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions