This repository was archived by the owner on Apr 12, 2024. It is now read-only.
This repository was archived by the owner on Apr 12, 2024. It is now read-only.
Date filter returns wrong week number #10450
Closed
Description
I've just met a case, when date filter returns next week number instead of this week's number for given date.
Today is Sunday, 14 December 2014, week 50.
var weekNum = $filter('date')(new Date(2014, 11, 14), 'ww'); //returns 51 instead of 50
I suppose that the reason for this is that in North American countries a start of the week is Sunday. If it's so, how to correct this kind of behaviour? Because I'm living in Europe and need Monday-Sunday week instead of Sunday - Saturday.
Edit:
In AngularJS documentation - 'ww' returns ISO-8601 week, but considering my issue, it's not ISO-8601 as this standard has Monday as a start of the week.
https://docs.angularjs.org/api/ng/filter/date
http://en.wikipedia.org/wiki/Seven-day_week#Week_numbering
Edit2:
AngularJS v1.3.0
Added locale 'uk-ua'