开发者

disable month end Days?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜