Skip to content

Default to space padding for "special" formats#6228

Merged
headius merged 1 commit intojruby:masterfrom
headius:strftime_space_padding
May 22, 2020
Merged

Default to space padding for "special" formats#6228
headius merged 1 commit intojruby:masterfrom
headius:strftime_space_padding

Conversation

@headius
Copy link
Member

@headius headius commented May 15, 2020

This fixes #6169 and I believe matches CRuby for the "special" formats handled here, but I am unsure if this is the right way to fix it. CRuby has something similar in its complicated strftime code, but they do not have a separate parser for date formats like we do.

@enebo I feel like this is something that should be done in the strftime parser; it should see that the next token is going to want space padding and insert the FORMAT_OUTPUT token with appropriate flags. What do you think?

@enebo
Copy link
Member

enebo commented May 18, 2020

@headius yeah maybe that works and is only a single pass over the format string. I guess it seems reasonable if that is really a hard and fast rule.

@headius
Copy link
Member Author

headius commented May 22, 2020

We will go with this fix for now but may want to rework this and add a format cache in the future.

@headius headius merged commit af1f4e1 into jruby:master May 22, 2020
@headius headius deleted the strftime_space_padding branch May 22, 2020 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

2 participants