Ion.Calendar 2.0.2
jQuery-calendar and datepicker,
based on powerful library to work with time - Moment.js

Feedback and support

If you find some bugs or missing functional in plugins, use Issues page on GitHub

Support

Support ion.RangeSlider «Patreon»
Bitcoin 13vdgT6EoAVupdGuLhE4ABW245NTixAj1G

Adv

Описание

  • Ion.Calendar based on powerful library to work with time - Moment.js.
  • Supports all languages, date formats and parsing abilities as Moment.js.
  • Calendar and datepicker in one.
  • Is fully customizable via CSS.
  • Calendar is flexible, can be placed in any content.
  • Supports multiple working calendars at one page.
  • Crossbrowser: Google Chrome, Mozilla Firefox, Opera, Safari, IE(8.0+)
  • Ion.Calendar supports touch-devices (iPhone, iPad, etc.).
  • GitHub page.
  • Ion.Calendar is freely distributed under terms of MIT licence.

Demos

Calendar in English. First week day - Sunday. Returns date in ISO8601 format. Years diapason: 1915-1995

$("#calendar-2").ionCalendar({
    lang: "en",
    years: "1915-1995",
    onClick: function(date){
        $("#result-2").html("onClick: " + date);
    }
});
...

Calendar in Russian. First week day - Monday. Returns date in format common in Russia: Day.Month.Year. Year diapason: current year -80 years.

$("#calendar-1").ionCalendar({
    lang: "ru",
    sundayFirst: false,
    years: "80",
    format: "DD.MM.YYYY",
    onClick: function(date){
        $("#result-1").html("onClick: " + date);
    }
});
...

Calendar in Japanese. First week day - Sunday. Return date in full local format. Years diapason: current year -20 years.

$("#calendar-3").ionCalendar({
    lang: "ja",
    years: "20",
    format: "LLLL",
    onClick: function(date){
        $("#result-3").html("onClick: " + date);
    }
});
...

Datepickers. All fields have different settings, placed via data-* attributes.

lang="ru"

years="50"

format="DD.MM.YYYY"

sundayfirst="true"

lang="en"

years="2015-2035"

format="YYYY-MM-DD"

lang="ja"

years="1973-2013"

format="YYYY-MM-DD"

lang="en"

years="10"

format="LL"

$(".date").each(function(){
    $(this).ionDatePicker();
});

Dependencies

Using script

Import this libraries:

  • jQuery
  • moment-with-locales.min.js
  • ion.calendar.min.js

CSS:

  • normalize.min.css - desirable if you have not yet connected one
  • ion.calendar.css

Prepare base block:

<div class="myCalendar" id="myCalendar-1"></div>

Initialize calendar:

$("#myCalendar-1").ionCalendar();

Or initialize calendar with custom settings:

$("#myCalendar-1").ionCalendar({
    lang: "ru",                     // language
    sundayFirst: false,             // first week day
    years: "80",                    // years diapason
    format: "DD.MM.YYYY",           // date format
    onClick: function(date){        // click on day returns date
        console.log(date);
    }
});

Making datepicker

Prepare base input field:

<input class="myInput" id="myDatePicker-1" data-lang="ru" data-years="1995-2013" data-sundayfirst="false" />

Initialize datepicker:

$("#myDatePicker-1").ionDatePicker();

Settings

Property Default Description
lang "en" An optional parameter that allows you to set the language of the calendar. Each additional language requires its own localization file
sundayFirst true An optional parameter that allows you to choose the first day of the week in the calendar. (For example in the U.S. week starts on Sunday in Russia on Monday). If true - then the first day will be Sunday, if false - it will be Monday.
years "80" An optional parameter that specifies the years range, for calendar to operate with. It may take 1 or 2 values separated by a hyphen. The values must be integers. A single value, such as "80" means that years range is: 80 years ago - the present year. Values separated by a hyphen, such as "1900-2000" sets the exact diapason from 1900, until the year 2000.
format An optional parameter that specifies the format of the returned date. Basic values: empty - will return date in ISO8601 format; "moment" - will return moment() object; "string formed by the rules of Moment.js" - will return date in that format. For example "YYYY-MM-DD" - will return "2013-07-15".
clickable true An optional parameter, if set to false - clicks on the days will do nothing.
hideArrows false An optional parameter, hides prev and next arrows.
startDate An optional parameter, allows to show selected date in calendar field (datepicker use it).
onClick Callback function. Returns selected date as string or moment() object.
onReady Callback function. Returns current date then calendar is ready.

Download

Support

Share

comments powered by Disqus
Fork me on GitHub