angular: Date pipe doesn't ignore details of formatting when using a custom format

I’m submitting a … (check one with “x”)

[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question

Current behavior Date pipe keeps the order of date components when using a custom format. According to the docs (https://angular.io/docs/ts/latest/api/common/index/DatePipe-pipe.html) this shouldn’t be the case: ‘In javascript, only the components specified will be respected (not the ordering, punctuations, …) and details of the formatting will be dependent on the locale.’

Expected behavior The date pipe should ignore ordering and whitespaces etc, it should only care about the date components and format the output date according to the locale.

Reproduction of the problem http://plnkr.co/edit/fCZ4oVcn5qsnNssvSnar?p=preview

What is the motivation / use case for changing the behavior? To be able to use custom date formats.

Please tell us about your environment: macOS Sierra, Visual Studio Code, NPM 3.10.3

  • Angular version: 2.0.0 (Final release)
  • Browser: all
  • Language: TypeScript 2.0.2
  • Node (for AoT issues): node --version = v6.3.0

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Comments: 20 (11 by maintainers)

Commits related to this issue

Most upvoted comments

No problem, I opened #19823