function getDateLastDayOfMonth(date) {
if (!date) return;
const [year, month] = date.split('-');
const lastDay = new Date(year, month, 0).getDate();
// JavaScript months are 0-indexed
return new Date(Date.UTC(year, month - 1, lastDay, 12));
}
Last active
November 9, 2023 13:19
-
-
Save sostenesapollo/0009aa302a8cfc189d2bbe08d05c3fca to your computer and use it in GitHub Desktop.
Get last day of month
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment