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
fix(common): format day-periods that cross midnight #36611
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the fix @petebacondarwin! 👍
I just left a couple minor comments, please have a look when you get a chance.
Quick question: should we consider this fix as a (minor) breaking change? Even though it's a bug fix, the behavior is slightly changed, so code that relied on the old behavior might need to be updated. What do you think @petebacondarwin?
I've started Blueprint Presubmit and Global Presubmit. Thank you. |
Personally, I don't see this as a breaking change. Sure the behaviour changed - but that is because it was broken before, no? I will change the commit message to highlight this change to what is output. |
24b735a
to
de79a09
Compare
I added a comment and updated the commit message - no code changes, so the presubmits should stand. |
@petebacondarwin FYI, Blueprint and Global presubmits are successful 👍 |
de79a09
to
e098516
Compare
When formatting a time with the `b` or `B` format codes, the rendered string was not correctly handling day periods that spanned midnight. Instead the logic was falling back to the default case of `AM`. Now the logic has been updated so that it matches times that are within a day period that spans midnight, so it will now render the correct output, such as `at night` in the case of English. Applications that are using either `formatDate()` or `DatePipe` and any of the `b` or `B` format codes will be affected by this change. Fixes angular#36566
e098516
to
8be5779
Compare
@AndrewKushnir do we need to run presubmit again, or can we add merge-assistance to push this through? |
@petebacondarwin, I think it's safe to reuse existing g3 global presubmit, so I forced "green" g3 status for this PR. Thank you. |
When formatting a time with the `b` or `B` format codes, the rendered string was not correctly handling day periods that spanned midnight. Instead the logic was falling back to the default case of `AM`. Now the logic has been updated so that it matches times that are within a day period that spans midnight, so it will now render the correct output, such as `at night` in the case of English. Applications that are using either `formatDate()` or `DatePipe` and any of the `b` or `B` format codes will be affected by this change. Fixes #36566 PR Close #36611
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
When formatting a time with the
b
orB
format codes,the resulting string should represent a period of the day.
The logic for computing this period is based on start and end
times, but the code was not able to cope with a period that
crossed midnight.
Fixes #36566