{"id":6303,"date":"2024-01-11T16:40:00","date_gmt":"2024-01-11T16:40:00","guid":{"rendered":"https:\/\/codehim.com\/?p=6303"},"modified":"2024-01-22T14:43:46","modified_gmt":"2024-01-22T09:43:46","slug":"dynamic-calendar-in-javascript-with-example","status":"publish","type":"post","link":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/","title":{"rendered":"45+ Dynamic Calendar in JavaScript Code with Example"},"content":{"rendered":"<p>This JavaScript code example helps you to create a dynamic calendar widget. It renders days, months, and years dynamically into a div element. The calendar widget comes with a user-friendly interface to navigate the next and previous month. Besides this, users can also jump to a specific month or year by selecting through a select dropdown.<\/p>\n<p>You can easily integrate this calendar widget into your website\/app project to display a general-purpose calendar. Similarly, you can customize the appearance of the calendar with additional CSS.<\/p>\n<p>Moreover, the calendar widget supports French and Indonesian languages. Basically, this calendar widget displays only dates with navigation. If you want to create a dynamic calendar with daily events, <a href=\"https:\/\/codehim.com\/date-time\/jquery-calendar-plugin-with-daily-events-clndr-js\/\" target=\"_blank\" rel=\"noopener\">check this calendar widget<\/a>.<\/p>\n<h2>How to Create Dynamic Calendar in JavaScript<\/h2>\n<p>1. First of all, create the HTML structure for the basic interface of the calendar as follows:<\/p>\n<pre class=\"prettyprint linenums lang-html\">         &lt;div class=\"wrapper\"&gt;\r\n    &lt;div class=\"container-calendar\"&gt;\r\n        &lt;h3 id=\"monthAndYear\"&gt;&lt;\/h3&gt;\r\n        &lt;div class=\"button-container-calendar\"&gt;\r\n            &lt;button id=\"previous\" onclick=\"previous()\"&gt;&amp;#8249;&lt;\/button&gt;\r\n            &lt;button id=\"next\" onclick=\"next()\"&gt;&amp;#8250;&lt;\/button&gt;\r\n        &lt;\/div&gt;\r\n        &lt;table class=\"table-calendar\" id=\"calendar\" data-lang=\"en\"&gt;\r\n            &lt;thead id=\"thead-month\"&gt;&lt;\/thead&gt;\r\n            &lt;tbody id=\"calendar-body\"&gt;&lt;\/tbody&gt;\r\n        &lt;\/table&gt;\r\n        &lt;div class=\"footer-container-calendar\"&gt;\r\n&lt;label for=\"month\"&gt;Jump To: &lt;\/label&gt;\r\n      &lt;select id=\"month\" onchange=\"jump()\"&gt;\r\n                 &lt;option value=0&gt;Jan&lt;\/option&gt;\r\n                 &lt;option value=1&gt;Feb&lt;\/option&gt;\r\n                 &lt;option value=2&gt;Mar&lt;\/option&gt;\r\n                 &lt;option value=3&gt;Apr&lt;\/option&gt;\r\n                 &lt;option value=4&gt;May&lt;\/option&gt;\r\n                 &lt;option value=5&gt;Jun&lt;\/option&gt;\r\n                 &lt;option value=6&gt;Jul&lt;\/option&gt;\r\n                 &lt;option value=7&gt;Aug&lt;\/option&gt;\r\n                 &lt;option value=8&gt;Sep&lt;\/option&gt;\r\n                 &lt;option value=9&gt;Oct&lt;\/option&gt;\r\n                 &lt;option value=10&gt;Nov&lt;\/option&gt;\r\n                 &lt;option value=11&gt;Dec&lt;\/option&gt;\r\n             &lt;\/select&gt;\r\n             &lt;select id=\"year\" onchange=\"jump()\"&gt;&lt;\/select&gt;       \r\n        &lt;\/div&gt;\r\n    &lt;\/div&gt;\r\n&lt;\/div&gt;\r\n<\/pre>\n<p>You can place the above HTML anywhere on your webpage where you want to display the calendar. If you want to change the language, set it through the data-lang attribute. The available languages are as follows:<\/p>\n<ul>\n<li>en for English (default)<\/li>\n<li>id for Indonesian<\/li>\n<li>fr for French<\/li>\n<\/ul>\n<p>2. After that, style the calendar using the following CSS styles. You can set the custom CSS values in order to change the interface of the calendar according to your theme.<\/p>\n<pre class=\"prettyprint linenums lang-css\">.wrapper {\r\n    margin: 15px auto;\r\n    max-width: 1100px;\r\n}\r\n\r\n.container-calendar {\r\n    background: #ffffff;\r\n    padding: 15px;\r\n    max-width: 475px;\r\n    margin: 0 auto;\r\n    overflow: auto;\r\n}\r\n\r\n.button-container-calendar button {\r\n    cursor: pointer;\r\n    display: inline-block;\r\n    zoom: 1;\r\n    background: #00a2b7;\r\n    color: #fff;\r\n    border: 1px solid #0aa2b5;\r\n    border-radius: 4px;\r\n    padding: 5px 10px;\r\n}\r\n\r\n.table-calendar {\r\n    border-collapse: collapse;\r\n    width: 100%;\r\n}\r\n\r\n.table-calendar td, .table-calendar th {\r\n    padding: 5px;\r\n    border: 1px solid #e2e2e2;\r\n    text-align: center;\r\n    vertical-align: top;\r\n}\r\n\r\n.date-picker.selected {\r\n    font-weight: bold;\r\n    outline: 1px dashed #00BCD4;\r\n}\r\n\r\n.date-picker.selected span {\r\n    border-bottom: 2px solid currentColor;\r\n}\r\n\r\n\/* sunday *\/\r\n.date-picker:nth-child(1) {\r\n  color: red;\r\n}\r\n\r\n\/* friday *\/\r\n.date-picker:nth-child(6) {\r\n  color: green;\r\n}\r\n\r\n#monthAndYear {\r\n    text-align: center;\r\n    margin-top: 0;\r\n}\r\n\r\n.button-container-calendar {\r\n    position: relative;\r\n    margin-bottom: 1em;\r\n    overflow: hidden;\r\n    clear: both;\r\n}\r\n\r\n#previous {\r\n    float: left;\r\n}\r\n\r\n#next {\r\n    float: right;\r\n}\r\n\r\n.footer-container-calendar {\r\n    margin-top: 1em;\r\n    border-top: 1px solid #dadada;\r\n    padding: 10px 0;\r\n}\r\n\r\n.footer-container-calendar select {\r\n    cursor: pointer;\r\n    display: inline-block;\r\n    zoom: 1;\r\n    background: #ffffff;\r\n    color: #585858;\r\n    border: 1px solid #bfc5c5;\r\n    border-radius: 3px;\r\n    padding: 5px 1em;\r\n}\r\n<\/pre>\n<p>3. Finally, add the following JavaScript code to functionalize the calendar.<\/p>\n<pre class=\"prettyprint linenums lang-js\">function generate_year_range(start, end) {\r\n    var years = \"\";\r\n    for (var year = start; year &lt;= end; year++) {\r\n        years += \"&lt;option value='\" + year + \"'&gt;\" + year + \"&lt;\/option&gt;\";\r\n    }\r\n    return years;\r\n}\r\n\r\ntoday = new Date();\r\ncurrentMonth = today.getMonth();\r\ncurrentYear = today.getFullYear();\r\nselectYear = document.getElementById(\"year\");\r\nselectMonth = document.getElementById(\"month\");\r\n\r\n\r\ncreateYear = generate_year_range(1970, 2050);\r\n\/** or\r\n * createYear = generate_year_range( 1970, currentYear );\r\n *\/\r\n\r\ndocument.getElementById(\"year\").innerHTML = createYear;\r\n\r\nvar calendar = document.getElementById(\"calendar\");\r\nvar lang = calendar.getAttribute('data-lang');\r\n\r\nvar months = \"\";\r\nvar days = \"\";\r\n\r\nvar monthDefault = [\"January\", \"February\", \"March\", \"April\", \"May\", \"June\", \"July\", \"August\", \"September\", \"October\", \"November\", \"December\"];\r\n\r\nvar dayDefault = [\"Sun\", \"Mon\", \"Tue\", \"Wed\", \"Thu\", \"Fri\", \"Sat\"];\r\n\r\nif (lang == \"en\") {\r\n    months = monthDefault;\r\n    days = dayDefault;\r\n} else if (lang == \"id\") {\r\n    months = [\"Januari\", \"Februari\", \"Maret\", \"April\", \"Mei\", \"Juni\", \"Juli\", \"Agustus\", \"September\", \"Oktober\", \"November\", \"Desember\"];\r\n    days = [\"Ming\", \"Sen\", \"Sel\", \"Rab\", \"Kam\", \"Jum\", \"Sab\"];\r\n} else if (lang == \"fr\") {\r\n    months = [\"Janvier\", \"F\u00e9vrier\", \"Mars\", \"Avril\", \"Mai\", \"Juin\", \"Juillet\", \"Ao\u00fbt\", \"Septembre\", \"Octobre\", \"Novembre\", \"D\u00e9cembre\"];\r\n    days = [\"dimanche\", \"lundi\", \"mardi\", \"mercredi\", \"jeudi\", \"vendredi\", \"samedi\"];\r\n} else {\r\n    months = monthDefault;\r\n    days = dayDefault;\r\n}\r\n\r\n\r\nvar $dataHead = \"&lt;tr&gt;\";\r\nfor (dhead in days) {\r\n    $dataHead += \"&lt;th data-days='\" + days[dhead] + \"'&gt;\" + days[dhead] + \"&lt;\/th&gt;\";\r\n}\r\n$dataHead += \"&lt;\/tr&gt;\";\r\n\r\n\/\/alert($dataHead);\r\ndocument.getElementById(\"thead-month\").innerHTML = $dataHead;\r\n\r\n\r\nmonthAndYear = document.getElementById(\"monthAndYear\");\r\nshowCalendar(currentMonth, currentYear);\r\n\r\n\r\n\r\nfunction next() {\r\n    currentYear = (currentMonth === 11) ? currentYear + 1 : currentYear;\r\n    currentMonth = (currentMonth + 1) % 12;\r\n    showCalendar(currentMonth, currentYear);\r\n}\r\n\r\nfunction previous() {\r\n    currentYear = (currentMonth === 0) ? currentYear - 1 : currentYear;\r\n    currentMonth = (currentMonth === 0) ? 11 : currentMonth - 1;\r\n    showCalendar(currentMonth, currentYear);\r\n}\r\n\r\nfunction jump() {\r\n    currentYear = parseInt(selectYear.value);\r\n    currentMonth = parseInt(selectMonth.value);\r\n    showCalendar(currentMonth, currentYear);\r\n}\r\n\r\nfunction showCalendar(month, year) {\r\n\r\n    var firstDay = ( new Date( year, month ) ).getDay();\r\n\r\n    tbl = document.getElementById(\"calendar-body\");\r\n\r\n    \r\n    tbl.innerHTML = \"\";\r\n\r\n    \r\n    monthAndYear.innerHTML = months[month] + \" \" + year;\r\n    selectYear.value = year;\r\n    selectMonth.value = month;\r\n\r\n    \/\/ creating all cells\r\n    var date = 1;\r\n    for ( var i = 0; i &lt; 6; i++ ) {\r\n        \r\n        var row = document.createElement(\"tr\");\r\n\r\n        \r\n        for ( var j = 0; j &lt; 7; j++ ) {\r\n            if ( i === 0 &amp;&amp; j &lt; firstDay ) {\r\n                cell = document.createElement( \"td\" );\r\n                cellText = document.createTextNode(\"\");\r\n                cell.appendChild(cellText);\r\n                row.appendChild(cell);\r\n            } else if (date &gt; daysInMonth(month, year)) {\r\n                break;\r\n            } else {\r\n                cell = document.createElement(\"td\");\r\n                cell.setAttribute(\"data-date\", date);\r\n                cell.setAttribute(\"data-month\", month + 1);\r\n                cell.setAttribute(\"data-year\", year);\r\n                cell.setAttribute(\"data-month_name\", months[month]);\r\n                cell.className = \"date-picker\";\r\n                cell.innerHTML = \"&lt;span&gt;\" + date + \"&lt;\/span&gt;\";\r\n\r\n                if ( date === today.getDate() &amp;&amp; year === today.getFullYear() &amp;&amp; month === today.getMonth() ) {\r\n                    cell.className = \"date-picker selected\";\r\n                }\r\n                row.appendChild(cell);\r\n                date++;\r\n            }\r\n\r\n\r\n        }\r\n\r\n        tbl.appendChild(row);\r\n    }\r\n\r\n}\r\n\r\nfunction daysInMonth(iMonth, iYear) {\r\n    return 32 - new Date(iYear, iMonth, 32).getDate();\r\n}\r\n<\/pre>\n<p>That&#8217;s all! hopefully, you have successfully integrated this JavaScript dynamic calendar example into your project. If you have any questions or facing any issues, feel free to comment below.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This JavaScript code example helps you to create a dynamic calendar widget. It renders days, months, and years dynamically into&#8230;<\/p>\n","protected":false},"author":1,"featured_media":6306,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[58],"tags":[91],"class_list":["post-6303","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-date-time","tag-calendar"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim<\/title>\n<meta name=\"description\" content=\"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim\" \/>\n<meta property=\"og:description\" content=\"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\" \/>\n<meta property=\"og:site_name\" content=\"CodeHim\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/codehimofficial\" \/>\n<meta property=\"article:published_time\" content=\"2024-01-11T16:40:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-01-22T09:43:46+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1247\" \/>\n\t<meta property=\"og:image:height\" content=\"936\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Asif Mughal\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:site\" content=\"@CodeHimOfficial\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Asif Mughal\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\"},\"author\":{\"name\":\"Asif Mughal\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\"},\"headline\":\"45+ Dynamic Calendar in JavaScript Code with Example\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:46+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\"},\"wordCount\":264,\"commentCount\":4,\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png\",\"keywords\":[\"Calendar\"],\"articleSection\":[\"Date &amp; Time\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\",\"url\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\",\"name\":\"45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim\",\"isPartOf\":{\"@id\":\"https:\/\/codehim.com\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png\",\"datePublished\":\"2024-01-11T16:40:00+00:00\",\"dateModified\":\"2024-01-22T09:43:46+00:00\",\"description\":\"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.\",\"breadcrumb\":{\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage\",\"url\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png\",\"contentUrl\":\"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png\",\"width\":1247,\"height\":936,\"caption\":\"Dynamic Calendar in JavaScript with Example\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/codehim.com\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Date &amp; Time\",\"item\":\"https:\/\/codehim.com\/category\/date-time\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"45+ Dynamic Calendar in JavaScript Code with Example\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/codehim.com\/#website\",\"url\":\"https:\/\/codehim.com\/\",\"name\":\"CodeHim\",\"description\":\"Web Design Code Snippets\",\"publisher\":{\"@id\":\"https:\/\/codehim.com\/#organization\"},\"alternateName\":\"Web Design Codes\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/codehim.com\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/codehim.com\/#organization\",\"name\":\"CodeHim - Web Design Code & Scripts\",\"url\":\"https:\/\/codehim.com\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\",\"url\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"contentUrl\":\"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg\",\"width\":280,\"height\":280,\"caption\":\"CodeHim - Web Design Code & Scripts\"},\"image\":{\"@id\":\"https:\/\/codehim.com\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/codehimofficial\",\"https:\/\/x.com\/CodeHimOfficial\",\"https:\/\/www.instagram.com\/codehim\/\",\"https:\/\/www.linkedin.com\/company\/codehim\",\"https:\/\/co.pinterest.com\/codehim\/\",\"https:\/\/www.youtube.com\/@codehim\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed\",\"name\":\"Asif Mughal\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/codehim.com\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g\",\"caption\":\"Asif Mughal\"},\"description\":\"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.\",\"sameAs\":[\"https:\/\/codehim.com\"],\"url\":\"https:\/\/codehim.com\/author\/asif-mughal\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim","description":"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/","og_locale":"en_US","og_type":"article","og_title":"45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim","og_description":"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.","og_url":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/","og_site_name":"CodeHim","article_publisher":"https:\/\/www.facebook.com\/codehimofficial","article_published_time":"2024-01-11T16:40:00+00:00","article_modified_time":"2024-01-22T09:43:46+00:00","og_image":[{"width":1247,"height":936,"url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png","type":"image\/png"}],"author":"Asif Mughal","twitter_card":"summary_large_image","twitter_creator":"@CodeHimOfficial","twitter_site":"@CodeHimOfficial","twitter_misc":{"Written by":"Asif Mughal","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#article","isPartOf":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/"},"author":{"name":"Asif Mughal","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed"},"headline":"45+ Dynamic Calendar in JavaScript Code with Example","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:46+00:00","mainEntityOfPage":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/"},"wordCount":264,"commentCount":4,"publisher":{"@id":"https:\/\/codehim.com\/#organization"},"image":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png","keywords":["Calendar"],"articleSection":["Date &amp; Time"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/","url":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/","name":"45+ Dynamic Calendar in JavaScript Code with Example &#8212; CodeHim","isPartOf":{"@id":"https:\/\/codehim.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage"},"image":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage"},"thumbnailUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png","datePublished":"2024-01-11T16:40:00+00:00","dateModified":"2024-01-22T09:43:46+00:00","description":"Here is a JavaScript code snippet with example to create a dynamic calendar widget. You can view demo and download calendar code.","breadcrumb":{"@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#primaryimage","url":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png","contentUrl":"https:\/\/codehim.com\/wp-content\/uploads\/2022\/04\/dynamic-calendar-in-javascript-with-example.png","width":1247,"height":936,"caption":"Dynamic Calendar in JavaScript with Example"},{"@type":"BreadcrumbList","@id":"https:\/\/codehim.com\/date-time\/dynamic-calendar-in-javascript-with-example\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/codehim.com\/"},{"@type":"ListItem","position":2,"name":"Date &amp; Time","item":"https:\/\/codehim.com\/category\/date-time\/"},{"@type":"ListItem","position":3,"name":"45+ Dynamic Calendar in JavaScript Code with Example"}]},{"@type":"WebSite","@id":"https:\/\/codehim.com\/#website","url":"https:\/\/codehim.com\/","name":"CodeHim","description":"Web Design Code Snippets","publisher":{"@id":"https:\/\/codehim.com\/#organization"},"alternateName":"Web Design Codes","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/codehim.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/codehim.com\/#organization","name":"CodeHim - Web Design Code & Scripts","url":"https:\/\/codehim.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/","url":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","contentUrl":"http:\/\/codehim.com\/wp-content\/uploads\/2023\/06\/Codehim-short-logo.jpg","width":280,"height":280,"caption":"CodeHim - Web Design Code & Scripts"},"image":{"@id":"https:\/\/codehim.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/codehimofficial","https:\/\/x.com\/CodeHimOfficial","https:\/\/www.instagram.com\/codehim\/","https:\/\/www.linkedin.com\/company\/codehim","https:\/\/co.pinterest.com\/codehim\/","https:\/\/www.youtube.com\/@codehim"]},{"@type":"Person","@id":"https:\/\/codehim.com\/#\/schema\/person\/cc48f1dbe072a89a62a98171b7db43ed","name":"Asif Mughal","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/codehim.com\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/b25bfcd7d4e341c2c6f785a88d8ad2a4?s=96&d=mm&r=g","caption":"Asif Mughal"},"description":"I code and create web elements for amazing people around the world. I like work with new people. New people new Experiences. I truly enjoy what I'm doing, which makes me more passionate about web development and coding. I am always ready to do challenging tasks whether it is about creating a custom CMS from scratch or customizing an existing system.","sameAs":["https:\/\/codehim.com"],"url":"https:\/\/codehim.com\/author\/asif-mughal\/"}]}},"views":28177,"_links":{"self":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6303","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/comments?post=6303"}],"version-history":[{"count":0,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/posts\/6303\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media\/6306"}],"wp:attachment":[{"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/media?parent=6303"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/categories?post=6303"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codehim.com\/wp-json\/wp\/v2\/tags?post=6303"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}