
META-INF.resources.bower_components.globalize.src.util.date.set-date.js Maven / Gradle / Ivy
define(function () {
/**
* Differently from native date.setDate(), this function returns a date whose
* day remains inside the month boundaries. For example:
*
* setDate( FebDate, 31 ): a "Feb 28" date.
* setDate( SepDate, 31 ): a "Sep 30" date.
*/
return function (date, day) {
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0).getDate();
date.setDate(day < 1 ? 1 : day < lastDay ? day : lastDay);
};
});
© 2015 - 2025 Weber Informatics LLC | Privacy Policy