Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

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

Comments

Projects
None yet
2 participants
@simonrussell
Copy link

simonrussell commented May 12, 2013

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

@ghost ghost assigned atambo May 17, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.