Skip to content

Commit da9b7a4

Browse files
committed
Merge branch 'vanilla'
Conflicts: CHANGELOG.md README.md bower.json component.json package.json pikaday.js
2 parents f1496e4 + fda071d commit da9b7a4

File tree

9 files changed

+364
-10
lines changed

9 files changed

+364
-10
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,28 @@
11
# Changelog
22

3+
## 1.4.0 - TBA
4+
5+
- Add theme class support, see #260
6+
- Fix on iOS, see #101
7+
- Fix #249
8+
9+
## 1.3.2 - Time
10+
11+
- Merge changes with main Pikaday
12+
13+
## 1.3.2 - 2015-02-17
14+
15+
- Add options to disable days, see #171
16+
- Add SCSS file, see #130
17+
18+
## 1.3.1 - 2015-02-04
19+
20+
- Fix for bug introduced in #166; fixes #224, #230
21+
322
## 1.3.0.1 - Time
423

524
- Fix introduced bug when fixing #7. Add needed guard code.
25+
- This is a bad version which `npm` and others do not like, lesson learned
626

727
## 1.3.0 - Time
828

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pikaday-time",
3-
"version": "1.3.0.1",
3+
"version": "1.3.2",
44
"description": "Time support added to pikaday",
55
"keywords": [
66
"datepicker",

component.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "pikaday-time",
33
"repo": "dbushell/Pikaday",
44
"description": "Time support added to pikaday",
5-
"version": "1.3.0.1",
5+
"version": "1.3.2",
66
"keywords": [
77
"datepicker",
88
"calendar",

css/theme.css

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/**
2+
* This theme is an example to show how you can create your own.
3+
*/
4+
.pika-single.dark-theme {
5+
color: #fff;
6+
background: #333;
7+
border: 1px solid #666;
8+
border-bottom-color: #999;
9+
}
10+
11+
.dark-theme .pika-label {
12+
background-color: #333;
13+
}
14+
15+
.dark-theme .pika-prev,
16+
.dark-theme .is-rtl .pika-next {
17+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAQAAACGG/bgAAAAQ0lEQVR4Ae3KIQ4AIBTD0N0/IeHGI3UIRA3ut/Zl+ltXc5++htVAmIAwAWECwgSEKbgthEoIlRAqIVRCqINQB9nDgQd7ktwFo6UpWQAAAABJRU5ErkJggg==');
18+
}
19+
20+
.dark-theme .pika-next,
21+
.dark-theme .is-rtl .pika-prev {
22+
background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABQAAAAeCAQAAACGG/bgAAAAP0lEQVQ4y+3TMQoAMAgEwfwfAvvjTZ1uGzuvHhBPPGczEG+FRqqRaqQaqUaqkX6QBmmjacvQ6qEVTjsh+xizebvlaWptGXZAAAAAAElFTkSuQmCC');
23+
}
24+
25+
.dark-theme .pika-table th {
26+
color: #999;
27+
}
28+
29+
.dark-theme .pika-button {
30+
color: #fff;
31+
background: #222;
32+
}
33+
34+
.dark-theme .pika-week {
35+
color: #999;
36+
}
37+
38+
.dark-theme .is-today .pika-button {
39+
color: #33aaff;
40+
}
41+
42+
.dark-theme .is-selected .pika-button {
43+
color: #fff;
44+
background: #33aaff;
45+
box-shadow: inset 0 1px 3px #178fe5;
46+
}
47+
48+
.dark-theme .is-disabled .pika-button {
49+
color: #999;
50+
opacity: .3;
51+
}
52+
53+
.dark-theme .pika-button:hover {
54+
color: #fff !important;
55+
background: #ff8000 !important;
56+
}

examples/theme.html

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1">
6+
<title>Pikaday - Theme example</title>
7+
<meta name="author" content="Stuart McFarlane">
8+
<link rel="stylesheet" href="../css/pikaday.css">
9+
<link rel="stylesheet" href="../css/theme.css">
10+
<link rel="stylesheet" href="../css/site.css">
11+
</head>
12+
<body>
13+
<a href="https://github.com/dbushell/Pikaday"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_gray_6d6d6d.png" alt="Fork me on GitHub"></a>
14+
15+
<h1>Pikaday - Theme example</h1>
16+
17+
<p class="large">A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS.</p>
18+
19+
<label for="datepicker">Date:</label>
20+
<br>
21+
No theme <input type="text" id="datepicker">
22+
<br>
23+
Custom theme <input type="text" id="datepicker-theme">
24+
25+
<h2>What is this?</h2>
26+
27+
<p>Since version 1.0 Pikaday is a stable and battle tested date-picker. Feel free to use it however you like but please report any bugs or feature requests to the <a href="https://github.com/dbushell/Pikaday/issues">GitHub issue tracker</a>, thanks!</p>
28+
29+
<p class="small">Copyright © 2014 <a href="http://dbushell.com/">David Bushell</a> | BSD &amp; MIT license | Example by <a href="https://github.com/rikkert">Ramiro Rikkert</a></p>
30+
31+
32+
<script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.5.1/moment.min.js"></script>
33+
<script src="../pikaday.js"></script>
34+
<script>
35+
36+
// You can use different themes with the `theme` option
37+
var pickerDefault = new Pikaday(
38+
{
39+
field: document.getElementById('datepicker'),
40+
});
41+
42+
var pickerTheme = new Pikaday(
43+
{
44+
field: document.getElementById('datepicker-theme'),
45+
theme: 'dark-theme'
46+
});
47+
48+
</script>
49+
</body>
50+
</html>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pikaday-time",
3-
"version": "1.3.0.1",
3+
"version": "1.3.2",
44
"description": "Time support added to pikaday",
55
"keywords": [
66
"datepicker",

pikaday.js

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,9 @@
263263
noon : 'Noon'
264264
},
265265

266+
// Theme Classname
267+
theme: null,
268+
266269
// callback function
267270
onSelect: null,
268271
onOpen: null,
@@ -456,7 +459,8 @@
456459
return;
457460
}
458461

459-
if (!(hasClass(target, 'is-disabled') || hasClass(target.parentElement, 'is-disabled'))) {
462+
e.preventDefault();
463+
if (!hasClass(target, 'is-disabled')) {
460464
if (hasClass(target, 'pika-button') && !hasClass(target, 'is-empty')) {
461465
var newDate = new Date(
462466
target.getAttribute('data-pika-year'),
@@ -599,9 +603,9 @@
599603
};
600604

601605
self.el = document.createElement('div');
602-
self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '');
606+
self.el.className = 'pika-single' + (opts.isRTL ? ' is-rtl' : '') + (opts.theme ? ' ' + opts.theme : '');
603607

604-
addEvent(self.el, 'mousedown', self._onMouseDown, true);
608+
addEvent(self.el, 'ontouchend' in document ? 'ontouchend' : 'mousedown', self._onMouseDown, true);
605609
addEvent(self.el, 'change', self._onChange);
606610

607611
if (opts.field) {
@@ -669,6 +673,8 @@
669673

670674
opts.field = (opts.field && opts.field.nodeName) ? opts.field : null;
671675

676+
opts.theme = (typeof opts.theme) == 'string' && opts.theme ? opts.theme : null;
677+
672678
opts.bound = !!(opts.bound !== undefined ? opts.field && opts.bound : opts.field);
673679

674680
opts.trigger = (opts.trigger && opts.trigger.nodeName) ? opts.trigger : opts.field;
@@ -690,9 +696,7 @@
690696
opts.maxDate = opts.minDate = false;
691697
}
692698
if (opts.minDate) {
693-
if (!opts.showTime) setToStartOfDay(opts.minDate);
694-
opts.minYear = opts.minDate.getFullYear();
695-
opts.minMonth = opts.minDate.getMonth();
699+
this.setMinDate(opts.minDate);
696700
}
697701
if (opts.maxDate) {
698702
if (!opts.showTime) setToStartOfDay(opts.maxDate);
@@ -923,7 +927,11 @@
923927
*/
924928
setMinDate: function(value)
925929
{
930+
if (!this._o.showTime) setToStartOfDay(this._o.minDate);
931+
setToStartOfDay(value);
926932
this._o.minDate = value;
933+
this._o.minYear = value.getFullYear();
934+
this._o.minMonth = value.getMonth();
927935
},
928936

929937
/**

0 commit comments

Comments
 (0)