i am using following code to create and show only current year calender … now i want to show years from current year to next 18 years only .. i am not able to do that please give me some logic to do that
<!DOCTYPE html>
<html >
<head>
<link rel="stylesheet" href="dojo/dojoroot/dijit/themes/claro/claro.css">
<style type="text/css">.undefined table.dijitCalendarContainer {
margin: 25px auto;
width: 200px;
}</style>
<script src='dojo/dojoroot/dojo/dojo.js' data-dojo-config='parseOnLoad: true'></script><script>require([
"dojo/ready",
"dijit/dijit", // loads the optimized dijit layer
"dijit/Calendar",
"dojo/date"
], function(ready, dijit, Calendar, date){
ready(function(){
new Calendar({
value: new Date(),
isDisabledDate: function(d){
// var d = new Date(d); d.setYear(2012);
var d = new Date(d); d.setHours(0, 0, 0, 0);
var today = new Date(); today.setYear(2012);
return Math.abs(date.difference(d, today, "year"));
}
}, "mycal");
});
});</script>
</head>
<body class="claro">
<div id="mycal"></div>
</body>
</html>
dijit.Calender.isDisabledDate should return boolean.
http://dojotoolkit.org/api/1.7/dijit/Calendar
Your current code is a little complex I think… more simply.
-current year
-current year to next 18 years