角日期过滤器是不是在Firefox workig [英] Angular Date filter is not workig in firefox

查看:162
本文介绍了角日期过滤器是不是在Firefox workig的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用日期过滤器格式化我在我的角度申请日期。

I am using date filter to format my date in my angular application.

在Firefox中,我得到的日期值

In Firefox, I'm getting the date value as

未定义NaN时,楠楠:楠:NaN的PM

undefined NaN, NaN NaN:NaN:NaN PM

在Chrome浏览器的作品完美地为

In Chrome its works perfectly as

2014年6月25日上午7时22分47秒。

Jun 25, 2014 7:22:47 AM

我的code是如下:

var formatDate = new Date(info.list[i].date);
var newDate=$filter('date')(formatDate, 'medium');

我如何得到它工作在Firefox?

How do I get it to work in Firefox?

推荐答案

我遇到了这个问题,发现问题是浏览器/ Opera和Firefox / Safari浏览器支持创建一个新的JavaScript Date对象不同的公差。

I ran into this issue and found that the problem was Chrome/Opera and Firefox/Safari have different tolerances for creating a new Javascript Date object.

这工作在Chrome和Opera,而不是Firefox和Safari:

This works in Chrome and Opera, but not Firefox and Safari:

var myDate = new Date("2014-08-12 11:46:26.509")

这个工程在所有浏览器中提到:

This works in all mentioned browsers:

var myDate = new Date("2014-08-12T11:46:26.509")

我曾经有一个适当的日期对象创建时,AngularJS日期过滤器工作正常。

Once I had a proper Date object created, the AngularJS date filter works as expected.

这篇关于角日期过滤器是不是在Firefox workig的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆