title: How to get last day of a given year with moment?
body: <p>I can hard-code the last day of a year because anyway it will always be 31st December. There are many solutions using <code>date</code>, <code>js</code>, <code>jquery</code>. But I'm working on an Angular project and hence my code is in <code>typescript</code>. My tech lead wants me to do this using <code>moment</code>. I'm not supposed to hard-code any date. Is there any built-in method provided by <code>moment</code> to fetch the last day of a <em>given</em> year. And I'm saying <em>given</em> year because in my case <em>given</em> year is dynamic. It can change anytime. I'm using <code>endOf()</code> method. I'm getting error with custom year. I mean:</p>
  
  <p><code>const lastDayOfYear = moment().endOf('year')</code> is working fine, but:</p>
  
  <p><code>const lastDayOfYear = moment().endOf(2025)</code> is giving me this error:</p>
  
  <blockquote>
    <p>Argument of type '2025' is not assignable to parameter of type 'StartOf'</p>
  </blockquote>
  
  <p>I also tried:</p>
  
  <ol>
  <li><code>const lastDayOfYear = moment().endOf("2025");</code></li>
  <li><code>year=2025; const lastDayOfYear = moment().endOf(year);</code></li>
  </ol>
  
  <p>How will this method work? I've gone through the entire <a href="https://momentjs.com/docs/" rel="nofollow noreferrer">Moment docs</a>. Or should I stick to <code>Date</code> of javascript. Something like this:</p>
  
  <p><code>new Date(new Date().getFullYear(), 11, 31);</code></p>
  
  <p>Please provide a solution.</p>
  
  <p>PS: I want last date of a given year in <code>MM-DD-YYYY</code> format only.</p>