Skip to content
/ PickMeUp Public
forked from nazar-pc/PickMeUp

Really simple, powerful and customizable datepicker

License

Notifications You must be signed in to change notification settings

trull/PickMeUp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PickMeUp - jQuery datepicker plugin

Really simple, powerful and customizable datepicker.

Author - Nazar Mokrynskyi

Based on DatePicker by Stefan Petre

It is very small:

  • 16.1 KiB minified JavaScript (4.5 KiB gzip)
  • 2.2 KiB minified CSS (703 B gzip)
  • 0 KiB images

Browser support:

  • IE 10+
  • Opera 12.1+
  • Latest versions of Firefox and Chrome

Getting started

You need only 2 files: js/jquery.pickmeup.min.js and css/pickmeup.min.css.

Then you can apply datepicker to any element:

$('.date').pickmeup();

Global default settings are stored in $.pickmeup

They can be redefined during initialization:

$('.date').pickmeup({
	format	: 'Y-m-d'
});

or with data-attributes with pmu- prefix:

<div class="date" data-pmu-format="Y-m-d"></div>

Configuration options

Option Value Default Description
date array/object/string new Date Selected date after initialization. Can be single date string/object or array depending on selection mode
flat boolean false Whatever if the date picker is appended to the element or triggered by an event
first_day 0/1 1 First day of week: 0 - Sunday, 1 - Monday
prev string Previous button content
next string Next button content
mode single/multiple/range single Date selection mode
view days/months/years days View mode after initialization
calendars int 1 Number of calendars, that will be rendered
format string d-m-Y Date format (aAbBCdeHIjklmMpPsSuwyY are supported)
position top/right/bottom/left bottom Date picker's position relative to the triggered element
trigger_event string click Event to trigger the date picker
class_name string Class to be added to root datepicker element
hide_on_select boolean false If true - datepicker will be hidden after selection (for range mode allows to select first and last days
min null/object/string null Min date available for selection, null means no limitation
max null/object/string null Max date available for selection, null means no limitation
locale object Object, that contains localized days of week names and months

Events callbacks

this in any callback will be the same element, on which pickmeup() was called. Events are specified as regular options:

object render (date)

Triggered on day element rendering, accepts date as argument and may return object with next properties:

  • selected: if true - date will be selected
  • disabled: if true - date will be disabled
  • class_name: will be added to class of day element
change (formatted_date)

Triggered at date change, accepts formatted date as argument

before_show ()

Triggered before showing

bool show ()

Triggered at showing, if not true returned - datepicker will not be shown

bool hide ()

Triggered at hiding, if not true returned - datepicker will not be hidden

Methods

Methods allows external control on datepicker

Hide
$('.date').pickmeup('hide');
Show
$('.date').pickmeup('show');
Get date
$('.date').pickmeup('get_date', formatted);

formatted - boolean (default false)

Set date
$('.date').pickmeup('set_date', date);

date - can be single date string/object or array depending on selection mode

Clear multiple selection
$('.date').pickmeup('clear');
Update datepicker

Is useful, for example, after input field change

$('.date').pickmeup('update');

Other

Current options (for whatever reason) can be accessed as $('...').data('pickmeup-options').

Root pickmeup element (jQuery collection object) can be accessed as $('...').get(0).pickmeup or directly this.pickmeup if inside callback.

Styling

If you want other colors - just change several variables in scss file.

To change size - adjust font-size for root datepicker element, everything will scale nicely.

Contribution

Feel free to create issues and send pull requests, they are highly appreciated!

License

MIT License, see license.txt

About

Really simple, powerful and customizable datepicker

Resources

License

Stars

Watchers

Forks

Packages

No packages published