Angular2 datepipe iOS incompatibility issue

Source: Internet
Author: User

Angular2 Pipe Pipeline {{Time | date: ' YYYY-MM-DD '}, date format adjustment using date, on Android display Ok,ios not displayed

Workaround: Use Angular2-moment

1. Installing Angular2-moment

npm install --save angular2-moment

Configuration in 2.module

...import {MomentModule} from "angular2-moment";@NgModule({  imports: [    MomentModule  ],...

3. Use

<P>angular2-moment: Abbreviated AM</P><P>1. How long ago: Amtimeago</p><p>2. Date Voice: Amlocale, put it in front of other pipes, or you will get an error. </p><p>{{' 1989-09-23 ' | amlocale: ' ZH-CN ' | amtimeago}}</p> <p>3. Date format: Yyyy-mm-dd hh:mm</p><p>{{' 2016-01-24 14:23:45 ' | Amlocale: ' ZH-CN ' | Amdateformat: ' yyyy-mm h:mm:ss a '}}</p>
< Span class= "Hljs-name" > < Span class= "hljs-template-variable" ><p>4. Date format: Yyyy-mm-dd</ p><p>{{' 2016-01-24 14:23:45 ' |amdateformat: ' yyyy-mm-dd '}} </P>           
<p>5. Timestamp </p> <p>{(1456263980 | amfromunix) |amlocale:' ZH-CN ' | Amdateformat: ' Yyyy-mm-dd hh:mm:ss A '}}</p>
<p>6. Move forward, Smart convert </p> <p>{36000 | amduration: ' Seconds '}} </p>

4. More Configuration Reference website

1、https://github.com/urish/angular2-moment/2、https://momentjs.com/
文章参考:1190000010711177





Angular2 datepipe iOS incompatibility issue

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.