打字稿Ionic 3模拟器和Firefox的日期无效 [英] Typescript Invalid date with Ionic 3 simulator and Firefox
本文介绍了打字稿Ionic 3模拟器和Firefox的日期无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有MomentJs的这个功能
I have this function with MomentJs
CreateFormat(date: string, time: string): string {
let now = moment(date + " " + time, "YYYY-MM-DD H:m:s z").toDate();
return moment(now, "YYYY-MM-DD H:m:s z").format("HH:mm");
}
我得到了这个结果:7:39 pm
i想显示它像这样19:39
I got this result : 7:39 pm i want to display it like this 19:39
推荐答案
我强烈推荐使用 momentJs 使用 Ionic 3
app.Then you won没有像现在这样的任何浏览器特定错误。
I highly recommend using momentJs with your Ionic 3
app.Then you won't have any browser specific errors like you have now.
npm安装时刻
npm install moment
.ts
import moment from 'moment';
let now = moment().format('LLLL');
更新:
moment("02:00 PM", "h:mm A").format("HH:mm") // "14:00"
这篇关于打字稿Ionic 3模拟器和Firefox的日期无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文