feat(common/datePipe):fix date formatter correct pattern сloses #7008#8154
Conversation
|
upgrade to rc1 version, could anyone please review it? 😅 |
|
@laskoviymishka We need tests with all of the changes. Could you please add them. |
|
Oops, my bad I accidentally killed added tests with a merge 😓 shame on me. I committed them back @mhevery thx for response! All needed tests already here, i could only add couple more for some complex scenarios. In a fact this change only reimplement internal logic that hided inside of date pipe. Old behaivior was already well tested, so i only add couple more test scenarios to check does new behaivior work also. To check out in a live this new date pipe logic you could also look at plnkr (http://plnkr.co/edit/BVfVx27Ko76PQPOu8Xl7?p=preview) that was added in PR message. It create new |
…loses angular#7008 - add regular expression to parse date parts - add date part creator function - replace tokens in pattern to parsed parts
d2cc2a8 to
3229c01
Compare
|
@mhevery could you please review, squash into single commit and bring back missed tests 🐱 UPD: looks like CI test fail not becouse of me (the same e2e test fails in master branch) |
|
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. |
Fix for issue when date pipe not correctly formatted, closes Date pipe is not working well with custom format #7008
See plnkr:
http://plnkr.co/edit/nNpBNaB8z7DEnZdpj7gM?p=preview
Currently formatter only looking on your locale and what you pass in pattern string not how (MM dd yyyy and dd MM yyyy is really same pattern for him). It have no affect to any formatting inside this pattern. In a fact it strongly coupled to https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/DateTimeFormat global object.
We parse pattern to date token, which materialized according to passed date and current locale (with DateTimeFormat global object as well). After parsing and materializing date parts we replace tokens to materialized parts.
See plnkr:
http://plnkr.co/edit/BVfVx27Ko76PQPOu8Xl7?p=preview
There is new version of date pipe that show how new formatter works
no