kea-rails 2.0.0.pre.alpha5 → 2.0.0.pre.alpha6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/javascripts/kea/bindings/date_picker.js +33 -0
- data/app/assets/javascripts/kea/extenders/date.js +10 -0
- data/app/assets/javascripts/kea/kea_dependencies.js +1 -0
- data/app/assets/stylesheets/kea/kea.css.sass +1 -1
- data/lib/kea-rails/version.rb +1 -1
- data/vendor/assets/components/pikaday/CHANGELOG.md +68 -0
- data/vendor/assets/components/pikaday/LICENSE +36 -0
- data/vendor/assets/components/pikaday/README.md +321 -0
- data/vendor/assets/components/pikaday/bower.json +29 -0
- data/vendor/assets/components/pikaday/component.json +17 -0
- data/vendor/assets/{stylesheets → components/pikaday/css}/pikaday.css +39 -7
- data/vendor/assets/components/pikaday/css/site.css +42 -0
- data/vendor/assets/components/pikaday/examples/amd.html +50 -0
- data/vendor/assets/components/pikaday/examples/bound-container.html +52 -0
- data/vendor/assets/components/pikaday/examples/calendars.html +57 -0
- data/vendor/assets/components/pikaday/examples/container.html +52 -0
- data/vendor/assets/components/pikaday/examples/jquery-amd.html +54 -0
- data/vendor/assets/components/pikaday/examples/jquery.html +46 -0
- data/vendor/assets/components/pikaday/examples/moment.html +53 -0
- data/vendor/assets/components/pikaday/examples/positions.html +106 -0
- data/vendor/assets/components/pikaday/examples/trigger.html +46 -0
- data/vendor/assets/components/pikaday/examples/weeknumbers.html +41 -0
- data/vendor/assets/components/pikaday/index.html +43 -0
- data/vendor/assets/components/pikaday/package.json +45 -0
- data/vendor/assets/{javascripts → components/pikaday}/pikaday.js +185 -52
- data/vendor/assets/components/pikaday/plugins/pikaday.jquery.js +52 -0
- data/vendor/assets/components/pikaday/scss/pikaday.scss +199 -0
- data/vendor/assets/components/pikaday/tests/methods.js +26 -0
- data/vendor/assets/components/pikaday/tests/module.js +24 -0
- metadata +27 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: af54eff7023152d3ecb1c55c4b2a2d7c60c5f262
|
4
|
+
data.tar.gz: 92d6efe82fac551cc364b7239524430ad68fe705
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fc35ed50c8757faa11bb9656a5739a086080795a7bd09bd7dbd7a20f6686feb36b0cc750d1deff3c313253601b3e97c0df6c83a64b1c119365ca3de7d303872b
|
7
|
+
data.tar.gz: 453afc42614917b3218cb424cdfb935c045fb8aae5d00b972e2822e5c0aefa0caf09b61d09d2e704f6734f2e100bf00eddea94225bd1344fab3be931b3b94c39
|
@@ -0,0 +1,33 @@
|
|
1
|
+
(function(ko, $) {
|
2
|
+
"use strict";
|
3
|
+
|
4
|
+
ko.bindingHandlers.datePicker = {
|
5
|
+
init: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
6
|
+
var $element = $(element),
|
7
|
+
observable = valueAccessor(),
|
8
|
+
options = allBindingsAccessor().options || {},
|
9
|
+
defaultOptions;
|
10
|
+
|
11
|
+
defaultOptions = {
|
12
|
+
field: element,
|
13
|
+
firstDay: 1,
|
14
|
+
defaultDate: observable.date(),
|
15
|
+
format: observable.date.options.external,
|
16
|
+
onSelect: function() {
|
17
|
+
observable.date.fromMoment( this.getMoment() );
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
options = $.extend({}, defaultOptions, options);
|
22
|
+
|
23
|
+
$element.data('pikaday', new Pikaday(options));
|
24
|
+
},
|
25
|
+
update: function(element, valueAccessor, allBindingsAccessor, viewModel, bindingContext) {
|
26
|
+
var observable = valueAccessor(),
|
27
|
+
pikaday = $(element).data('pikaday');
|
28
|
+
|
29
|
+
pikaday.setMoment( observable.date.toMoment() );
|
30
|
+
}
|
31
|
+
};
|
32
|
+
|
33
|
+
})(ko, $);
|
@@ -23,6 +23,16 @@
|
|
23
23
|
target(formatted);
|
24
24
|
}
|
25
25
|
}, this);
|
26
|
+
|
27
|
+
target.date.toMoment = function toMoment() {
|
28
|
+
return moment(target(), options.internal);
|
29
|
+
};
|
30
|
+
|
31
|
+
target.date.fromMoment = function fromMoment(moment) {
|
32
|
+
target( moment.format(options.internal) );
|
33
|
+
};
|
34
|
+
|
35
|
+
target.date.options = options;
|
26
36
|
|
27
37
|
//return the original observable
|
28
38
|
return target;
|
data/lib/kea-rails/version.rb
CHANGED
@@ -0,0 +1,68 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
## 1.4.0 - TBA
|
4
|
+
|
5
|
+
|
6
|
+
## 1.3.2 - 2015-02-17
|
7
|
+
|
8
|
+
- Add options to disable days, see #171
|
9
|
+
- Add SCSS file, see #130
|
10
|
+
|
11
|
+
## 1.3.1 - 2015-02-04
|
12
|
+
|
13
|
+
- Fix for bug introduced in #166; fixes #224, #230
|
14
|
+
|
15
|
+
## 1.3.0 - 2015-01-09
|
16
|
+
|
17
|
+
- Fix #79 moving through months can cause calendar to "bounce around"
|
18
|
+
- Add configurable number of shown months
|
19
|
+
- #51 Add unit tests with ci: [testling](https://ci.testling.com/rikkert/pikaday)
|
20
|
+
- Fix #94 blur input field after date selection
|
21
|
+
- Add configuable container to render calendar into
|
22
|
+
- Add option to show week numbers, see #147
|
23
|
+
- Positioning is now optional, see #192
|
24
|
+
|
25
|
+
## 1.2.0 - 2014-01-28
|
26
|
+
|
27
|
+
- Fix #8 Automatically adjust datepicker position
|
28
|
+
- Merge #45 Adjusting position
|
29
|
+
- Merge #11 Allow using a different element to open and bind the datepicker to
|
30
|
+
- Use new Bower package filename: bower.json
|
31
|
+
- Merge #90 Configuration options for the title, useful for Asian languages.
|
32
|
+
- Merge #96 Use proper UMD-wrapper
|
33
|
+
- Merge #92 Export as CommonJS module
|
34
|
+
- Merge #119 Use a px text-indent on .pika-prev/next to prevent Firefox bug
|
35
|
+
- Merge #60 Add customizable position option
|
36
|
+
- Add Component package definition
|
37
|
+
|
38
|
+
## 1.1.0 - 2013-03-29
|
39
|
+
|
40
|
+
- Add Ruby on Rails [gem](https://rubygems.org/gems/pikaday-gem)
|
41
|
+
- Add project configuration files. (jshint and editorconfig)
|
42
|
+
- Add AMD support to pikaday and pikaday.jquery
|
43
|
+
|
44
|
+
- Fix #52 check if date is valid when moment.js is available
|
45
|
+
- Fix #54 add CSS support for IE8
|
46
|
+
|
47
|
+
Notes:
|
48
|
+
|
49
|
+
- jQuery plugin needs pikaday.js loaded first
|
50
|
+
- See the examples/ dir:
|
51
|
+
- amd.html module loading example
|
52
|
+
- jquery-amd.html module loading the jQuery plugin example
|
53
|
+
- jquery.html jQuery plugin example
|
54
|
+
- moment.html moment.js library example
|
55
|
+
|
56
|
+
## 1.0.0 - 2013-03-15
|
57
|
+
|
58
|
+
- Fix issue #41 (minDate does not include the specified date)
|
59
|
+
- Add Bower package definition
|
60
|
+
|
61
|
+
## 0.0.2 - 2012-10-10
|
62
|
+
|
63
|
+
- jQuery plugin version
|
64
|
+
|
65
|
+
## 0.0.1 - 2012-10-08
|
66
|
+
|
67
|
+
- Basic documentation written
|
68
|
+
- GitHub repository is ready to go…
|
@@ -0,0 +1,36 @@
|
|
1
|
+
Copyright (c) 2014 David Bushell BSD & MIT license
|
2
|
+
|
3
|
+
The MIT License (MIT)
|
4
|
+
|
5
|
+
Copyright (c) 2014 David Bushell
|
6
|
+
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
8
|
+
of this software and associated documentation files (the "Software"), to deal
|
9
|
+
in the Software without restriction, including without limitation the rights
|
10
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
11
|
+
copies of the Software, and to permit persons to whom the Software is
|
12
|
+
furnished to do so, subject to the following conditions:
|
13
|
+
|
14
|
+
The above copyright notice and this permission notice shall be included in
|
15
|
+
all copies or substantial portions of the Software.
|
16
|
+
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
20
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
21
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
22
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
23
|
+
THE SOFTWARE.
|
24
|
+
|
25
|
+
The BSD License
|
26
|
+
|
27
|
+
Copyright (c) 2014 David Bushell
|
28
|
+
All rights reserved.
|
29
|
+
|
30
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
31
|
+
|
32
|
+
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
33
|
+
|
34
|
+
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
35
|
+
|
36
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
@@ -0,0 +1,321 @@
|
|
1
|
+
Pikaday
|
2
|
+
========
|
3
|
+
|
4
|
+
### A refreshing JavaScript Datepicker
|
5
|
+
|
6
|
+
* Lightweight (less than 5kb minified and gzipped)
|
7
|
+
* No dependencies (but plays well with [Moment.js][moment])
|
8
|
+
* Modular CSS classes for easy styling
|
9
|
+
|
10
|
+
[**Try Pikaday Demo →**][Pikaday]
|
11
|
+
|
12
|
+
![Pikaday Screenshot][screenshot]
|
13
|
+
|
14
|
+
**Production ready?** Since version 1.0.0 Pikaday is stable and used in production. If you do however find bugs or have feature requests please submit them to the [GitHub issue tracker][issues].
|
15
|
+
Also see the [changelog](CHANGELOG.md)
|
16
|
+
|
17
|
+
|
18
|
+
## Usage
|
19
|
+
|
20
|
+
**Pikaday** can be bound to an input field:
|
21
|
+
|
22
|
+
```html
|
23
|
+
<input type="text" id="datepicker">
|
24
|
+
```
|
25
|
+
|
26
|
+
Add the JavaScript to the end of your document:
|
27
|
+
|
28
|
+
```html
|
29
|
+
<script src="pikaday.js"></script>
|
30
|
+
<script>
|
31
|
+
var picker = new Pikaday({ field: document.getElementById('datepicker') });
|
32
|
+
</script>
|
33
|
+
```
|
34
|
+
|
35
|
+
If you're using **jQuery** make sure to pass only the first element:
|
36
|
+
|
37
|
+
```javascript
|
38
|
+
var picker = new Pikaday({ field: $('#datepicker')[0] });
|
39
|
+
```
|
40
|
+
|
41
|
+
If the Pikaday instance is not bound to a field you can append the element anywhere:
|
42
|
+
|
43
|
+
```javascript
|
44
|
+
var field = document.getElementById('datepicker');
|
45
|
+
var picker = new Pikaday({
|
46
|
+
onSelect: function(date) {
|
47
|
+
field.value = picker.toString();
|
48
|
+
}
|
49
|
+
});
|
50
|
+
field.parentNode.insertBefore(picker.el, field.nextSibling);
|
51
|
+
```
|
52
|
+
|
53
|
+
For advanced formatting load [Moment.js][moment] prior to Pikaday:
|
54
|
+
See the [moment.js example][] for a full version.
|
55
|
+
|
56
|
+
```html
|
57
|
+
<input type="text" id="datepicker" value="9 Oct 2014">
|
58
|
+
|
59
|
+
<script src="moment.js"></script>
|
60
|
+
<script src="pikaday.js"></script>
|
61
|
+
<script>
|
62
|
+
var picker = new Pikaday({
|
63
|
+
field: document.getElementById('datepicker'),
|
64
|
+
format: 'D MMM YYYY',
|
65
|
+
onSelect: function() {
|
66
|
+
console.log(this.getMoment().format('Do MMMM YYYY'));
|
67
|
+
}
|
68
|
+
});
|
69
|
+
</script>
|
70
|
+
```
|
71
|
+
|
72
|
+
### Configuration
|
73
|
+
|
74
|
+
As the examples demonstrate above
|
75
|
+
Pikaday has many useful options:
|
76
|
+
|
77
|
+
* `field` bind the datepicker to a form field
|
78
|
+
* `trigger` use a different element to trigger opening the datepicker, see [trigger example][] (default to `field`)
|
79
|
+
* `bound` automatically show/hide the datepicker on `field` focus (default `true` if `field` is set)
|
80
|
+
* `position` preferred position of the datepicker relative to the form field, e.g.: `top right`, `bottom right` **Note:** automatic adjustment may occur to avoid datepicker from being displayed outside the viewport, see [positions example][] (default to 'bottom left')
|
81
|
+
* `reposition` can be set to false to not reposition datepicker within the viewport, forcing it to take the configured `position` (default: true)
|
82
|
+
* `container` DOM node to render calendar into, see [container example][] (default: undefined)
|
83
|
+
* `format` the default output format for `.toString()` and `field` value (requires [Moment.js][moment] for custom formatting)
|
84
|
+
* `defaultDate` the initial date to view when first opened
|
85
|
+
* `setDefaultDate` make the `defaultDate` the initial selected value
|
86
|
+
* `firstDay` first day of the week (0: Sunday, 1: Monday, etc)
|
87
|
+
* `minDate` the minimum/earliest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`)
|
88
|
+
* `maxDate` the maximum/latest date that can be selected (this should be a native Date object - e.g. `new Date()` or `moment().toDate()`)
|
89
|
+
* `disableWeekends` disallow selection of Saturdays or Sundays
|
90
|
+
* `disableDayFn` callback function that gets passed a Date object for each day in view. Should return true to disable selection of that day.
|
91
|
+
* `yearRange` number of years either side (e.g. `10`) or array of upper/lower range (e.g. `[1900,2015]`)
|
92
|
+
* `showWeekNumber` show the ISO week number at the head of the row (default `false`)
|
93
|
+
* `isRTL` reverse the calendar for right-to-left languages
|
94
|
+
* `i18n` language defaults for month and weekday names (see internationalization below)
|
95
|
+
* `yearSuffix` additional text to append to the year in the title
|
96
|
+
* `showMonthAfterYear` render the month after year in the title (default `false`)
|
97
|
+
* `numberOfMonths` number of visible calendars
|
98
|
+
* `mainCalendar` when `numberOfMonths` is used, this will help you to choose where the main calendar will be (default `left`, can be set to `right`). Only used for the first display or when a selected date is not already visible
|
99
|
+
* `onSelect` callback function for when a date is selected
|
100
|
+
* `onOpen` callback function for when the picker becomes visible
|
101
|
+
* `onClose` callback function for when the picker is hidden
|
102
|
+
* `onDraw` callback function for when the picker draws a new month
|
103
|
+
|
104
|
+
## jQuery Plugin
|
105
|
+
|
106
|
+
The normal version of Pikaday does not require jQuery, however there is a jQuery plugin if that floats your boat (see `plugins/pikaday.jquery.js` in the repository). This version requires jQuery, naturally, and can be used like other plugins:
|
107
|
+
See the [jQuery example][] for a full version.
|
108
|
+
|
109
|
+
```html
|
110
|
+
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
|
111
|
+
<script src="pikaday.js"></script>
|
112
|
+
<script src="plugins/pikaday.jquery.js"></script>
|
113
|
+
<script>
|
114
|
+
|
115
|
+
// activate datepickers for all elements with a class of `datepicker`
|
116
|
+
$('.datepicker').pikaday({ firstDay: 1 });
|
117
|
+
|
118
|
+
// chain a few methods for the first datepicker, jQuery style!
|
119
|
+
$('.datepicker').eq(0).pikaday('show').pikaday('gotoYear', 2042);
|
120
|
+
|
121
|
+
</script>
|
122
|
+
```
|
123
|
+
|
124
|
+
## AMD support
|
125
|
+
|
126
|
+
If you use a modular script loader than Pikaday is not bound to the global object and will fit nicely in your build process. You can require Pikaday just like any other module.
|
127
|
+
See the [AMD example][] for a full version.
|
128
|
+
|
129
|
+
```javascript
|
130
|
+
require(['pikaday'], function(Pikaday) {
|
131
|
+
var picker = new Pikaday({ field: document.getElementById('datepicker') });
|
132
|
+
});
|
133
|
+
```
|
134
|
+
The same applies for the jQuery plugin mentioned above.
|
135
|
+
See the [jQuery AMD example][] for a full version.
|
136
|
+
|
137
|
+
```javascript
|
138
|
+
require(['jquery', 'pikaday.jquery'], function($) {
|
139
|
+
$('#datepicker').pikaday();
|
140
|
+
});
|
141
|
+
```
|
142
|
+
|
143
|
+
## CommonJS module support
|
144
|
+
|
145
|
+
If you use a CommonJS compatible environment you can use the require function to import Pikaday.
|
146
|
+
|
147
|
+
|
148
|
+
```javascript
|
149
|
+
var pikaday = require('pikaday');
|
150
|
+
```
|
151
|
+
|
152
|
+
When you bundle all your required modules with [Browserify][browserify] and you don't use [Moment.js][moment] specify the ignore option:
|
153
|
+
|
154
|
+
`browserify main.js -o bundle.js -i moment`
|
155
|
+
|
156
|
+
## Ruby on Rails
|
157
|
+
|
158
|
+
If you're using **Ruby on Rails**, make sure to check out the [Pikaday gem][gem].
|
159
|
+
|
160
|
+
## Methods
|
161
|
+
|
162
|
+
You can control the date picker after creation:
|
163
|
+
|
164
|
+
```javascript
|
165
|
+
var picker = new Pikaday({ field: document.getElementById('datepicker') });
|
166
|
+
```
|
167
|
+
|
168
|
+
### Get and set date
|
169
|
+
|
170
|
+
`picker.toString('YYYY-MM-DD')`
|
171
|
+
|
172
|
+
Returns the selected date in a string format. If [Moment.js][moment] exists (recommended) then Pikaday can return any format that Moment understands, otherwise you're stuck with JavaScript's default.
|
173
|
+
|
174
|
+
`picker.getDate()`
|
175
|
+
|
176
|
+
Returns a basic JavaScript `Date` object of the selected day, or `null` if no selection.
|
177
|
+
|
178
|
+
`picker.setDate('2015-01-01')`
|
179
|
+
|
180
|
+
Set the current selection. This will be restricted within the bounds of `minDate` and `maxDate` options if they're specified. You can optionally pass a boolean as the second parameter to prevent triggering of the onSelect callback (true), allowing the date to be set silently.
|
181
|
+
|
182
|
+
`picker.getMoment()`
|
183
|
+
|
184
|
+
Returns a [Moment.js][moment] object for the selected date (Moment must be loaded before Pikaday).
|
185
|
+
|
186
|
+
`picker.setMoment(moment('14th February 2014', 'DDo MMMM YYYY'))`
|
187
|
+
|
188
|
+
Set the current selection with a [Moment.js][moment] object (see `setDate` for details).
|
189
|
+
|
190
|
+
### Change current view
|
191
|
+
|
192
|
+
`picker.gotoDate(new Date(2014, 1))`
|
193
|
+
|
194
|
+
Change the current view to see a specific date. This example will jump to February 2014 ([month is a zero-based index][mdn_date]).
|
195
|
+
|
196
|
+
`picker.gotoToday()`
|
197
|
+
|
198
|
+
Shortcut for `picker.gotoDate(new Date())`
|
199
|
+
|
200
|
+
`picker.gotoMonth(2)`
|
201
|
+
|
202
|
+
Change the current view by month (0: January, 1: Februrary, etc).
|
203
|
+
|
204
|
+
`picker.nextMonth()`
|
205
|
+
`picker.prevMonth()`
|
206
|
+
|
207
|
+
Go to the next or previous month (this will change year if necessary).
|
208
|
+
|
209
|
+
`picker.gotoYear()`
|
210
|
+
|
211
|
+
Change the year being viewed.
|
212
|
+
|
213
|
+
`picker.setMinDate()`
|
214
|
+
|
215
|
+
Update the minimum/earliest date that can be selected.
|
216
|
+
|
217
|
+
`picker.setMaxDate()`
|
218
|
+
|
219
|
+
Update the maximum/latest date that can be selected.
|
220
|
+
|
221
|
+
### Show and hide datepicker
|
222
|
+
|
223
|
+
`picker.isVisible()`
|
224
|
+
|
225
|
+
Returns `true` or `false`.
|
226
|
+
|
227
|
+
`picker.show()`
|
228
|
+
|
229
|
+
Make the picker visible.
|
230
|
+
|
231
|
+
`picker.adjustPosition()`
|
232
|
+
|
233
|
+
Recalculate and change the position of the picker.
|
234
|
+
|
235
|
+
`picker.hide()`
|
236
|
+
|
237
|
+
Hide the picker making it invisible.
|
238
|
+
|
239
|
+
`picker.destroy()`
|
240
|
+
|
241
|
+
Hide the picker and remove all event listeners — no going back!
|
242
|
+
|
243
|
+
### Internationalization
|
244
|
+
|
245
|
+
The default `i18n` configuration format looks like this:
|
246
|
+
|
247
|
+
```javascript
|
248
|
+
i18n: {
|
249
|
+
previousMonth : 'Previous Month',
|
250
|
+
nextMonth : 'Next Month',
|
251
|
+
months : ['January','February','March','April','May','June','July','August','September','October','November','December'],
|
252
|
+
weekdays : ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
|
253
|
+
weekdaysShort : ['Sun','Mon','Tue','Wed','Thu','Fri','Sat']
|
254
|
+
}
|
255
|
+
```
|
256
|
+
|
257
|
+
You must provide 12 months and 7 weekdays (with abbreviations). Always specify weekdays in this order with Sunday first. You can change the `firstDay` option to reorder if necessary (0: Sunday, 1: Monday, etc). You can also set `isRTL` to `true` for languages that are read right-to-left.
|
258
|
+
|
259
|
+
|
260
|
+
## Extensions
|
261
|
+
|
262
|
+
### Timepicker
|
263
|
+
|
264
|
+
Pikaday is a pure datepicker. It will not support picking a time of day. However, there have been efforts to add time support to Pikaday.
|
265
|
+
See [#1][issue1] and [#18][issue18]. These reside in their own fork.
|
266
|
+
|
267
|
+
You can use the work [@owenmead][owenmead] did most recently at [owenmead/Pikaday][owen Pika]
|
268
|
+
A more simple time selection approach done by [@xeeali][xeeali] at [xeeali/Pikaday][xeeali Pika] is based on version 1.2.0.
|
269
|
+
Also [@stas][stas] has a fork [stas/Pikaday][stas Pika], but is now quite old
|
270
|
+
|
271
|
+
|
272
|
+
## Browser Compatibility
|
273
|
+
|
274
|
+
* IE 7+
|
275
|
+
* Chrome 8+
|
276
|
+
* Firefox 3.5+
|
277
|
+
* Safari 3+
|
278
|
+
* Opera 10.6+
|
279
|
+
|
280
|
+
[![browser compatibility](https://ci.testling.com/rikkert/pikaday.png)
|
281
|
+
](https://ci.testling.com/rikkert/pikaday)
|
282
|
+
|
283
|
+
|
284
|
+
* * *
|
285
|
+
|
286
|
+
## Authors
|
287
|
+
|
288
|
+
* David Bushell [http://dbushell.com][Bushell] [@dbushell][Bushell Twitter]
|
289
|
+
* Ramiro Rikkert [GitHub][Rikkert] [@RamRik][Rikkert Twitter]
|
290
|
+
|
291
|
+
Thanks to [@shoogledesigns][shoogledesigns] for the name.
|
292
|
+
|
293
|
+
Copyright © 2014 David Bushell | BSD & MIT license
|
294
|
+
|
295
|
+
[Pikaday]: http://dbushell.github.com/Pikaday/ "Pikaday"
|
296
|
+
[moment]: http://momentjs.com/ "moment.js"
|
297
|
+
[browserify]: http://browserify.org/ "browserify"
|
298
|
+
[screenshot]: https://raw.github.com/dbushell/Pikaday/gh-pages/screenshot.png "Screenshot"
|
299
|
+
[issues]: https://github.com/dbushell/Pikaday/issues "Issue tracker"
|
300
|
+
[gem]: https://rubygems.org/gems/pikaday-gem "RoR gem"
|
301
|
+
[mdn_date]: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/Date "Date"
|
302
|
+
[Bushell]: http://dbushell.com/ "dbushell.com"
|
303
|
+
[Bushell Twitter]: https://twitter.com/dbushell "@dbushell"
|
304
|
+
[Rikkert]: https://github.com/rikkert "Rikkert GitHub"
|
305
|
+
[Rikkert Twitter]: https://twitter.com/ramrik "@ramrik"
|
306
|
+
[shoogledesigns]: https://twitter.com/shoogledesigns/status/255209384261586944 "@shoogledesigns"
|
307
|
+
[issue1]: https://github.com/dbushell/Pikaday/issues/1 "Issue 1"
|
308
|
+
[issue18]: https://github.com/dbushell/Pikaday/issues/18 "Issue 18"
|
309
|
+
[stas]: https://github.com/stas "@stas"
|
310
|
+
[stas Pika]: https://github.com/stas/Pikaday "Pikaday"
|
311
|
+
[owenmead]: https://github.com/owenmead "@owenmead"
|
312
|
+
[owen Pika]: https://github.com/owenmead/Pikaday "Pikaday"
|
313
|
+
[xeeali]: https://github.com/xeeali "@xeeali"
|
314
|
+
[xeeali Pika]: https://github.com/xeeali/Pikaday "Pikaday"
|
315
|
+
[moment.js example]: http://dbushell.github.com/Pikaday/examples/moment.html "Pikaday w/ moment.js"
|
316
|
+
[jQuery example]: http://dbushell.github.com/Pikaday/examples/jquery.html "Pikaday w/ jQuery"
|
317
|
+
[AMD example]: http://dbushell.github.com/Pikaday/examples/amd.html "Pikaday w/ AMD"
|
318
|
+
[jQuery AMD example]: http://dbushell.github.com/Pikaday/examples/jquery-amd.html "Pikaday w/ jQuery + AMD"
|
319
|
+
[trigger example]: http://dbushell.github.com/Pikaday/examples/trigger.html "Pikaday using custom trigger"
|
320
|
+
[positions example]: http://dbushell.github.com/Pikaday/examples/positions.html "Pikaday using different position options"
|
321
|
+
[container example]: http://dbushell.github.com/Pikaday/examples/container.html "Pikaday using custom calendar container"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
{
|
2
|
+
"name": "pikaday",
|
3
|
+
"version": "1.3.2",
|
4
|
+
"description": "A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS",
|
5
|
+
"keywords": [
|
6
|
+
"datepicker",
|
7
|
+
"calendar",
|
8
|
+
"date"
|
9
|
+
],
|
10
|
+
"main": [
|
11
|
+
"./pikaday.js",
|
12
|
+
"./css/pikaday.css"
|
13
|
+
],
|
14
|
+
"dependencies": {},
|
15
|
+
"ignore": [
|
16
|
+
"**/.*",
|
17
|
+
"node_modules",
|
18
|
+
"components"
|
19
|
+
],
|
20
|
+
"license" : [
|
21
|
+
"BSD",
|
22
|
+
"MIT"
|
23
|
+
],
|
24
|
+
"homepage": "http://dbushell.github.io/Pikaday/",
|
25
|
+
"repository": {
|
26
|
+
"type": "git",
|
27
|
+
"url": "https://github.com/dbushell/Pikaday.git"
|
28
|
+
}
|
29
|
+
}
|
@@ -0,0 +1,17 @@
|
|
1
|
+
{
|
2
|
+
"name": "pikaday",
|
3
|
+
"repo": "dbushell/Pikaday",
|
4
|
+
"description": "A refreshing JavaScript Datepicker — lightweight, no dependencies, modular CSS",
|
5
|
+
"version": "1.3.2",
|
6
|
+
"keywords": [
|
7
|
+
"datepicker",
|
8
|
+
"calendar",
|
9
|
+
"date"
|
10
|
+
],
|
11
|
+
"main": "pikaday.js",
|
12
|
+
"scripts": ["pikaday.js"],
|
13
|
+
"styles": ["css/pikaday.css"],
|
14
|
+
"dependencies": {},
|
15
|
+
"demo": "http://dbushell.github.io/Pikaday/",
|
16
|
+
"license": "MIT"
|
17
|
+
}
|
@@ -2,15 +2,13 @@
|
|
2
2
|
|
3
3
|
/*!
|
4
4
|
* Pikaday
|
5
|
-
* Copyright ©
|
5
|
+
* Copyright © 2014 David Bushell | BSD & MIT license | http://dbushell.com/
|
6
6
|
*/
|
7
7
|
|
8
8
|
.pika-single {
|
9
9
|
z-index: 9999;
|
10
10
|
display: block;
|
11
11
|
position: relative;
|
12
|
-
width: 240px;
|
13
|
-
padding: 8px;
|
14
12
|
color: #333;
|
15
13
|
background: #fff;
|
16
14
|
border: 1px solid #ccc;
|
@@ -18,6 +16,18 @@
|
|
18
16
|
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
|
19
17
|
}
|
20
18
|
|
19
|
+
/*
|
20
|
+
clear child float (pika-lendar), using the famous micro clearfix hack
|
21
|
+
http://nicolasgallagher.com/micro-clearfix-hack/
|
22
|
+
*/
|
23
|
+
.pika-single:before,
|
24
|
+
.pika-single:after {
|
25
|
+
content: " ";
|
26
|
+
display: table;
|
27
|
+
}
|
28
|
+
.pika-single:after { clear: both }
|
29
|
+
.pika-single { *zoom: 1 }
|
30
|
+
|
21
31
|
.pika-single.is-hidden {
|
22
32
|
display: none;
|
23
33
|
}
|
@@ -27,6 +37,12 @@
|
|
27
37
|
box-shadow: 0 5px 15px -5px rgba(0,0,0,.5);
|
28
38
|
}
|
29
39
|
|
40
|
+
.pika-lendar {
|
41
|
+
float: left;
|
42
|
+
width: 240px;
|
43
|
+
margin: 8px;
|
44
|
+
}
|
45
|
+
|
30
46
|
.pika-title {
|
31
47
|
position: relative;
|
32
48
|
text-align: center;
|
@@ -66,13 +82,14 @@
|
|
66
82
|
padding: 0;
|
67
83
|
width: 20px;
|
68
84
|
height: 30px;
|
85
|
+
/* hide text using text-indent trick, using width value (it's enough) */
|
86
|
+
text-indent: 20px;
|
87
|
+
white-space: nowrap;
|
88
|
+
overflow: hidden;
|
69
89
|
background-color: transparent;
|
70
90
|
background-position: center center;
|
71
91
|
background-repeat: no-repeat;
|
72
92
|
background-size: 75% 75%;
|
73
|
-
white-space: nowrap;
|
74
|
-
text-indent: 100%;
|
75
|
-
overflow: hidden;
|
76
93
|
opacity: .5;
|
77
94
|
*position: absolute;
|
78
95
|
*top: 0;
|
@@ -118,6 +135,7 @@
|
|
118
135
|
.pika-table th,
|
119
136
|
.pika-table td {
|
120
137
|
width: 14.285714285714286%;
|
138
|
+
padding: 0;
|
121
139
|
}
|
122
140
|
|
123
141
|
.pika-table th {
|
@@ -131,6 +149,8 @@
|
|
131
149
|
.pika-button {
|
132
150
|
cursor: pointer;
|
133
151
|
display: block;
|
152
|
+
box-sizing: border-box;
|
153
|
+
-moz-box-sizing: border-box;
|
134
154
|
outline: none;
|
135
155
|
border: 0;
|
136
156
|
margin: 0;
|
@@ -143,6 +163,11 @@
|
|
143
163
|
background: #f5f5f5;
|
144
164
|
}
|
145
165
|
|
166
|
+
.pika-week {
|
167
|
+
font-size: 11px;
|
168
|
+
color: #999;
|
169
|
+
}
|
170
|
+
|
146
171
|
.is-today .pika-button {
|
147
172
|
color: #33aaff;
|
148
173
|
font-weight: bold;
|
@@ -168,4 +193,11 @@
|
|
168
193
|
background: #ff8000 !important;
|
169
194
|
box-shadow: none !important;
|
170
195
|
border-radius: 3px !important;
|
171
|
-
}
|
196
|
+
}
|
197
|
+
|
198
|
+
/* styling for abbr */
|
199
|
+
.pika-table abbr {
|
200
|
+
border-bottom: none;
|
201
|
+
cursor: help;
|
202
|
+
}
|
203
|
+
|