Minimal Date Picker Calendar In Pure JS – pureJSCalendar

Category: Date & Time , Javascript | January 13, 2019
Author:MrGuiseppe
Views Total:6,796 views
Official Page:Go to website
Last Update:January 13, 2019
License:MIT

Preview:

Minimal Date Picker Calendar In Pure JS – pureJSCalendar

Description:

A pure JavaScript calendar component allows the user to select a date from a clean calendar popup. Without any dependencies.

How to use it:

Download and import the pureJSCalendar’s files into the html file.

<link rel="stylesheet" href="css/calendar.css">
<script src="scripts/pureJSCalendar.js"></script>

Create an input filed to store the selected date.

<input type="text" id="example">

Open the calendar and save the selected date in the input field you just created.

// pureJSCalendar.open(dateFormat, x, y, firstDayOfWeek, minDate, maxDate, element, zindex)
pureJSCalendar.open('dd.MM.yyyy', 20, 30, 1, '2018-5-5', '2019-8-20', 'example', 20)

Close the calendar.

pureJSCalendar.close()

Changelog:

01/13/2018

  • JS update

You Might Be Interested In:


3 thoughts on “Minimal Date Picker Calendar In Pure JS – pureJSCalendar

  1. Wagner Ferreira.

    Hi, your last update resolved the undefined problem for january, but is limiting the days of january equal the days of current month.
    Let me explain better, on january i only been able to select til 13th of the month, that is the same that ocurs on february.

    Reply
  2. Mike D

    Hi – Lovely calendar, but I am having an issue where some months it only lets me select the first two weeks of the month. Could this be related to a local issue, using US date formats?

    Reply
  3. Jon Luong

    Found the bug in the code where it disables any dates after the day you’ve selected. In line 137 of pureJSCalendar.js, you have this:

    if (year > eFormMinimalDate.year || year >= eFormMaximalDate.year && month >= eFormMaximalDate.month – 1) {

    It should be this:
    if (year > eFormMaximalDate.year || year >= eFormMaximalDate.year && month >= eFormMaximalDate.month – 1) {

    You used the eFormMinimalDate for year comparison in the disable above maximal date

    Reply

Leave a Reply