fix: implement dayPeriod and ensure hour12 functions properly#45
fix: implement dayPeriod and ensure hour12 functions properly#45
Conversation
|
Code Climate has analyzed commit 2f46bb5 and detected 0 issues on this pull request. The test coverage on the diff in this pull request is 100.0% (80% is the threshold). This pull request will bring the total coverage in the repository to 97.4% (0.1% change). View more on Code Climate. |
jmauerhan
left a comment
There was a problem hiding this comment.
I do not envy you working on this, breaks my brain a bit :D
|
|
||
| break; | ||
| case 'b': // am, pm, noon, midnight | ||
| if ($length === 5) { |
There was a problem hiding this comment.
Good question. 5 is the magic number for "narrow" in this documentation: https://unicode-org.github.io/cldr/ldml/tr35-dates.html
It would be good to try to abstract this into a constant. However, I think this entire class needs to be refactored. In its current form, it's a straight port of JavaScript code to PHP, which is why it looks the way it does. I would never have written it like this to begin with. 😉
Description
The
dayPeriodproperty was an oversight, so this implements it, while fixing a logic error in thehour12functionality.Product requirements and context
How has this been tested?
PR Checklist