OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Is there a way to count number of ISO weeks in a given year using Moment.js?

  • Thread starter Thread starter Necky
  • Start date Start date
N

Necky

Guest
I need to determine how many ISO weeks a year has.

My attempt looks like this

Code:
moment.tz(2019, "YYYY", "UTC").endOf("year").isoWeek()

But that doesn't do the job. 31st of December is ISO week 1 in some cases.

Ofc, there are probably some ugly ways to get the result, but i would like a clean code.

<p>I need to determine how many ISO weeks a year has.</p>
<p>My attempt looks like this</p>
<pre><code>moment.tz(2019, "YYYY", "UTC").endOf("year").isoWeek()
</code></pre>
<p>But that doesn't do the job. 31st of December is ISO week 1 in some cases.</p>
<p>Ofc, there are probably some ugly ways to get the result, but i would like a clean code.</p>
 

Latest posts

S
Replies
0
Views
1
Safwan Aipuram
S
Top