Skip to content

Date pipe with 'medium' format adds/truncates zero from single-digit hours and seconds #13

@NickIliev

Description

@NickIliev

From @otaran on May 22, 2017 19:39

Steps to reproduce

  1. Create date with hours < 10 and seconds < 10.
  2. Display this date with date pipe and medium format:
@Component({
    template: `<Label [text]="now | date:'medium'"></Label>
})
export class DateComponent {
    now = Date.parse('2017-05-22T07:05:09Z');
}

Expected result

The date doesn't have leading zero in hours, has leading zero in seconds and has a comma after year: May 22, 2017, 7:05:09 AM (in UTC timezone).

Actual result

The date has leading zero in hours, doesn't have leading zero in seconds and doesn't have a comma after year: May 22, 2017 07:05:9 AM (in UTC timezone).

Notes

Plunker to demonstrate expected Angular behavior: https://embed.plnkr.co/eF8VFN/
Nativescript app to demonstrate actual behavior: tns-date-pipe.zip

Copied from original issue: NativeScript/nativescript-angular#815

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions