开发者

disable month end Days?

开发者 https://www.devze.com 2023-01-13 07:50 出处:网络
How to disable month end Days like 30,31, 28(feb), 29 feb(leep year)? in js c开发者_开发百科alenderTo check if a date should be included, create a Date object from the components, then check if it con

How to disable month end Days like 30,31, 28(feb), 29 feb(leep year)? in js c开发者_开发百科alender


To check if a date should be included, create a Date object from the components, then check if it contains the expected day. If the date doesn't exist, for example 2010-02-31, it will become the corresponding date in the next month, i.e. 2010-03-03.

Example:

function checkIfDayExists(year, month, day) {
  var d = new Date(year, month - 1, day);
  return d.getDay == day;
}
0

精彩评论

暂无评论...
验证码 换一张
取 消