0

Is there any proper solution/patch to get week numbers correctly in extjs?

new Date('1 jan 2009').getWeekOfYear(); // will returned : 1

but

new Date('1 jan 2010').getWeekOfYear(); // will returned : 53
Bhavin Bathani
  • 190
  • 1
  • 12
  • Looks like the returned week numbers are correct, at least according to [ISO 8601](http://en.wikipedia.org/wiki/ISO_8601). – Teemu Dec 12 '13 at 07:29
  • ok. got the point. but is there any logic to decide the week number at the starting of year. – Bhavin Bathani Dec 12 '13 at 07:34
  • note that 1 jan 2010 is the same week as the last week of 2009. Why do you need to alter this logic? It depends from `locale` in most languages - not sure about javascript – Adassko Dec 12 '13 at 07:42
  • @bhavin There's [a formula](http://stackoverflow.com/a/6117889/1169519)..., or [Wikipedia](http://en.wikipedia.org/wiki/ISO_week_date#Calculation). Anyway you'd need some info of the previous year too. – Teemu Dec 12 '13 at 07:46
  • Thanks a lot, now i got the complete idea, i was absolutely unaware of "first week" and "last week" funda. Thanks guys for your kind support. – Bhavin Bathani Dec 12 '13 at 07:54

0 Answers0