moment.format() 下一年的日期在当前 return 的最后一周与当年
moment.format() of date for next year in last week of current return with current year
我在这里使用日期和方法 .format() of the Moment.js with Angular.js project, the issue simply that I get the correct day when I print it using .toISOString() 时有些奇怪,但 .format()
完全错误,下面的示例说明了这种情况:
这样的代码:
var app = angular.module('myApp', []);
app.controller('MyCtrl', function($scope) {
$scope.isoString = moment().week(53).weekday(6).toISOString();
$scope.formatString = moment().week(53).weekday(6).format('Do of MMMM GGGG');
$scope.year = moment().week(53).weekday(6).years();
});
Return 结果如下:
Correct ISO String : 2016-01-02T09:40:31.236Z
Incorrect formate String: 2nd of January 2015
Year : 2016
这是plnkr.co
中的陈列柜
对此有任何解决方案或描述吗?
年份使用 YYYY
而不是 GGGG
:
$scope.formatString = moment().week(53).weekday(6).format('Do of MMMM YYYY');
我在这里使用日期和方法 .format() of the Moment.js with Angular.js project, the issue simply that I get the correct day when I print it using .toISOString() 时有些奇怪,但 .format()
完全错误,下面的示例说明了这种情况:
这样的代码:
var app = angular.module('myApp', []);
app.controller('MyCtrl', function($scope) {
$scope.isoString = moment().week(53).weekday(6).toISOString();
$scope.formatString = moment().week(53).weekday(6).format('Do of MMMM GGGG');
$scope.year = moment().week(53).weekday(6).years();
});
Return 结果如下:
Correct ISO String : 2016-01-02T09:40:31.236Z
Incorrect formate String: 2nd of January 2015
Year : 2016
这是plnkr.co
中的陈列柜对此有任何解决方案或描述吗?
年份使用 YYYY
而不是 GGGG
:
$scope.formatString = moment().week(53).weekday(6).format('Do of MMMM YYYY');