解决方法
就像你在
the docs中看到的那样:
At this time,there is no one-size-fits-all standard to automatically
choose the correct language/spelling for a month name,or day of the
week name,depending on the language or locale
和
All things considered,the by far easiest solution is to just provide
an array of names if the app needs to use names other than the default
English version of month and day names. The month names and day names
can be either configured at the app level,or individual ion-datetime
level.
App配置级别
//app.module.ts @NgModule({ ...,imports: [ IonicModule.forRoot(MyApp,{ monthNames: ['janeiro','fevereiro','mar\u00e7o',... ],monthShortNames: ['jan','fev','mar',dayNames: ['domingo','segunda-feira','ter\u00e7a-feira',dayShortNames: ['dom','seg','ter',}) ],... })
组件输入级别
<ion-item> <ion-label>Período</ion-label> <ion-datetime displayFormat="dddd MMM D,YYYY" [(ngModel)]="myDate" monthNames="janeiro,fevereiro,mar\u00e7o,..." monthShortNames="jan,fev,mar,..." dayNames="domingo,segunda-feira,ter\u00e7a-feira,..." dayShortNames="dom,seg,ter,..."></ion-datetime> </ion-item>
并且为了更改按钮的文本:
<ion-datetime cancelText="'CustomCancel'" doneText="'CustomDone'" ...></ion-datetime>
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。