strftime "-" flag affects more than one field at a time (inconsistent with MRI) #731

Closed
simonrussell opened this Issue May 12, 2013 · 0 comments

Projects

None yet

2 participants

@simonrussell

The "-" flag in strftime (e.g. "%-H" to remove padding) as implemented in JRuby 1.7.3 affects all fields after the field with the "-" flag, and it shouldn't.

Examples in JRuby 1.7.3:

Time.utc(2012, 1, 1, 1, 1).strftime('%H:%M:%S')
=> "01:01:00"
Time.utc(2012, 1, 1, 1, 1).strftime('%-H:%M:%S')
=> "1:1:0"
Time.utc(2012, 1, 1, 1, 1).strftime('%H:%-M:%S')
=> "01:1:0"

Same examples in Ruby 1.9.3:

Time.utc(2012, 1, 1, 1, 1).strftime('%H:%M:%S')
=> "01:01:00" 
Time.utc(2012, 1, 1, 1, 1).strftime('%-H:%M:%S')
=> "1:01:00" 
Time.utc(2012, 1, 1, 1, 1).strftime('%H:%-M:%S')
=> "01:1:00"
@atambo atambo closed this in 7128ea2 May 17, 2013
@atambo atambo was assigned May 17, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment