Date-time "eomonth" ignores the year component.

Date-time "eomonth" ignores the year component.

Executing this on 06th Dec 2013,

both the alerts print "31-Dec-2013" while the expected result in the second print at line:5 is "31-Dec-2008".

  1. dateParam = "13-Dec-2013".toDate();
  2. alert eomonth(dateParam,0);

  3. dateParam = "13-Dec-2008".toDate();
  4. alert eomonth(dateParam,0);
For now, I'm using the following work-around with expected results:

  1. dateParam = toStartOfMonth("13-Dec-2013".toDate());
  2. alert dateParam.addMonth(1).subDay(1);

-Varun