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