forked from amsul/pickadate.js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocs.htm
420 lines (332 loc) · 12.8 KB
/
docs.htm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
<meta name="viewport" content="width=device-width,maximum-scale=1">
<title>Pickadate.js • Documentation</title>
<link rel="stylesheet" href="style.css">
<link rel="stylesheet" href="demo.css">
<link rel="stylesheet" href="pickadate.css">
<section class="holder">
<h1><a href="http://amsul.github.com/pickadate.js" class="link-inherit"><strong title="Pick a Date" class="underline-highlight">pickadate.js</strong></a></h1>
<h2>A lightweight jQuery dateinput picker</h2>
<h3>Weighs 6.7kb (2.7kb gzipped) <small class="dimmed"><small><small><small>– whereas jQuery UI datepicker is 42kb minified</small></small></small></small></h3>
<a href="https://github.com/amsul/pickadate.js"><img width="124" height="124" style="position:absolute;top:0;right:0;border:0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<h4><a href="https://github.com/amsul/pickadate.js/archive/gh-pages.zip">Download pickadate.js</a> or <a href="https://github.com/amsul/pickadate.js">view it on Github</a></h4>
</section>
<section class="holder">
<h3>All the options and default settings:</h3>
<pre><code><a href="#strings">// Strings</a>
months_full: [ 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December' ],
months_short: [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ],
weekdays_full: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
weekdays_short: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
month_prev: '&#9664;',
month_next: '&#9654;',
<a href="#ranges">// Date ranges</a>
date_min: true,
date_max: false,
<a href="#strings">// Display strings</a>
show_months_full: true,
show_weekdays_short: true,
<a href="#formats">// Date format</a>
format: 'd mmmm, yyyy',
<a href="#disable">// Disable picker</a>
disable_picker: false,
<a href="#theme">// Classes</a>
class_input_focus: 'datepicker--input__focused',
class_picker_open: 'datepicker--opened',
class_picker_holder: 'datepicker--holder',
class_calendar_box: 'datepicker--calendar__box',
class_calendar: 'datepicker--calendar',
class_calendar_body: 'datepicker--calendar__body',
class_calendar_date: 'datepicker--calendar__date',
class_year: 'datepicker--year',
class_month: 'datepicker--month',
class_month_nav: 'datepicker--month__nav',
class_month_prev: 'datepicker--month__prev',
class_month_next: 'datepicker--month__next',
class_week: 'datepicker--week',
class_weekdays: 'datepicker--weekday',
class_day_disabled: 'datepicker--day__disabled',
class_day_selected: 'datepicker--day__selected',
class_day_today: 'datepicker--day__today',
class_day_infocus: 'datepicker--day__infocus',
class_day_outfocus: 'datepicker--day__outfocus',
class_box_months: 'datepicker--holder__months',
class_box_years: 'datepicker--holder__years',
class_box_weekdays: 'datepicker--holder__weekdays'</code></pre>
</section>
<section class="holder">
<fieldset>
<h3><strong class="underline-highlight">Simple setup</strong></h3>
<input id="input_01" class="datepicker" type="text">
</fieldset>
<pre><code>$( '.datepicker' ).datepicker()</code></pre>
</section>
<section class="holder" id="strings">
<fieldset>
<h3><strong class="underline-highlight">Custom month and weekday tags</strong></h3>
<input id="input_02" class="datepicker" type="text">
</fieldset>
<pre><code>$( '.datepicker' ).datepicker({
month_prev: '&larr;',
month_next: '&rarr;',
weekdays_short: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
show_months_full: false
})</code></pre>
</section>
<section class="holder" id="formats">
<fieldset>
<h3><strong class="underline-highlight">Custom date formats</strong></h3>
<input id="input_03" class="datepicker" type="text">
</fieldset>
<pre><code>$( '.datepicker' ).datepicker({
format: 'dddd, dd/mm/yyyy'
})</code></pre>
<p>The date formats follow these rules:</p>
<table class="table" width="100%">
<thead>
<tr>
<th>Rule</th>
<th>Result</th>
<th>Example</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>d</code></td>
<td>Date</td>
<td>1-31</td>
</tr>
<tr>
<td><code>dd</code></td>
<td>Date with leading zero</td>
<td>01-31</td>
</tr>
<tr>
<td><code>ddd</code></td>
<td>Weekday – short</td>
<td>Sun-Sat</td>
</tr>
<tr>
<td><code>dddd</code></td>
<td>Weekday – full</td>
<td>Sunday-Saturday</td>
</tr>
<tr>
<td><code>m</code></td>
<td>Month</td>
<td>1-12</td>
</tr>
<tr>
<td><code>mm</code></td>
<td>Month with leading zero</td>
<td>01-12</td>
</tr>
<tr>
<td><code>mmm</code></td>
<td>Month name – short</td>
<td>Jan-Dec</td>
</tr>
<tr>
<td><code>mmmm</code></td>
<td>Month name – full</td>
<td>January-December</td>
</tr>
<tr>
<td><code>yy</code></td>
<td>Year – short</td>
<td>00-99</td>
</tr>
<tr>
<td><code>yyyy</code></td>
<td>Year – full</td>
<td>2000-2999</td>
</tr>
</tbody>
</table>
<p>To escape any letter, just add an <code>!</code> right before the letter. Example:</p>
<p><code>'You selecte!d: dd-mm-yyyy'</code></p>
</section>
<section class="holder" id="disable">
<fieldset>
<h3><strong class="underline-highlight">Disable picker for native calendar</strong></h3>
<input id="input_04" class="datepicker" type="date">
</fieldset>
<pre><code>$( '.datepicker' ).datepicker({
disable_picker: true
})
</code></pre>
<p>Some browsers have good native support for <code>type="date"</code>.</p>
<p>If you want to selectively disable the picker for these browsers, I would suggest detecing for support with something like <a target="_blank" href="http://modernizr.com/">Modernizr</a> and then setting <code>disable_picker</code> to <code>true</code>.</p>
</section>
<section class="holder" id="ranges">
<fieldset>
<h3><strong class="underline-highlight">Minimum and maximum date range</strong></h3>
<input id="input_05" class="datepicker" type="text">
</fieldset>
<pre><code>$( '.datepicker' ).datepicker({
date_min: false,
date_max: 5
})
</code></pre>
<p>The default settings for <code>date_min</code> is <code>true</code> whereas <code>date_max</code> is <code>false</code>.</p>
<p><code>date_min</code> and <code>date_max</code> can be either</p>
<ol>
<li>an array (format: [ YYYY, MM, DD ] )</li>
<li>or true / false</li>
</ol>
<p><code>date_max</code> can also be an integer - representing the number of days till the max date.</p>
</section>
<section class="holder" id="theme">
<style>
.datepicker-themed {
position: relative;
}
.datepicker-themed .datepicker--calendar__box {
border: none;
max-width: 100%;
-webkit-box-shadow: 0 0 0 6px #e20, 0 24px 54px 18px rgba(0,0,0,.2);
-moz-box-shadow: 0 0 0 6px #e20, 0 24px 54px 18px rgba(0,0,0,.2);
box-shadow: 0 0 0 6px #e20, 0 24px 54px 18px rgba(0,0,0,.2);
-webkit-border-radius: 0;
-moz-border-radius: 0;
border-radius: 0;
}
.datepicker-themed .datepicker--month {
text-transform: uppercase;
font-weight: bold;
font-style: italic;
}
.datepicker-themed .datepicker--calendar__date {
border-left: 1px solid #e20;
border-top: 1px solid #e20;
border-bottom: 1px solid #e20;
-webkit-border-radius: 16px;
-moz-border-radius: 16px;
border-radius: 16px;
}
.datepicker-themed tr:last-child .datepicker--calendar__date {
border-bottom: 1px solid #e20;
}
.datepicker-themed .datepicker--calendar__date:last-child {
border-right: 1px solid #e20;
}
.datepicker-themed .datepicker--day__today {
font-weight: bold;
color: #e20;
}
.datepicker-themed .datepicker--day__selected,
.datepicker-themed .datepicker--day__infocus:hover,
.datepicker-themed .datepicker--day__outfocus:hover,
.datepicker-themed .datepicker--month__prev:hover,
.datepicker-themed .datepicker--month__next:hover {
background: #e20;
color: #fff;
font-weight: bold;
}
.datepicker-themed .datepicker--day__outfocus {
border-color: #ccc !important;
color: #999;
}
.datepicker-themed .datepicker--day__disabled,
.datepicker-themed .datepicker--day__disabled:hover {
border-color: #ddd !important;
color: #bbb !important;
background: #f5f5f5 !important;
font-weight: 100 !important;
-moz-opacity: .6;
opacity: .6;
}
</style>
<fieldset class="datepicker-themed">
<h3><strong class="underline-highlight">Themed calendar</strong></h3>
<p>Go crazy.</p>
<input id="input_06" class="datepicker" type="text">
</fieldset>
<pre><code>.datepicker-themed {
position: relative;
}
.datepicker-themed .datepicker--calendar__box {
border: none;
max-width: 100%;
box-shadow: 0 0 0 6px #e20, 0 24px 54px 18px rgba(0,0,0,.2);
border-radius: 0;
}
.datepicker-themed .datepicker--month {
text-transform: uppercase;
font-weight: bold;
font-style: italic;
}
.datepicker-themed .datepicker--calendar__date {
border-left: 1px solid #e20;
border-top: 1px solid #e20;
border-bottom: 1px solid #e20;
border-radius: 16px;
}
.datepicker-themed tr:last-child .datepicker--calendar__date {
border-bottom: 1px solid #e20;
}
.datepicker-themed .datepicker--calendar__date:last-child {
border-right: 1px solid #e20;
}
.datepicker-themed .datepicker--day__today {
font-weight: bold;
color: #e20;
}
.datepicker-themed .datepicker--day__selected,
.datepicker-themed .datepicker--day__infocus:hover,
.datepicker-themed .datepicker--day__outfocus:hover,
.datepicker-themed .datepicker--month__prev:hover,
.datepicker-themed .datepicker--month__next:hover {
background: #e20;
color: #fff;
font-weight: bold;
}
.datepicker-themed .datepicker--day__outfocus {
border-color: #ccc !important;
color: #999;
}
.datepicker-themed .datepicker--day__disabled,
.datepicker-themed .datepicker--day__disabled:hover {
border-color: #ddd !important;
color: #bbb !important;
background: #f5f5f5 !important;
font-weight: 100 !important;
opacity: .6;
}</code></pre>
</section>
<section class="holder aligncenter">
<p><a class="button-full" href="https://github.com/amsul/pickadate.js/archive/gh-pages.zip">Download pickadate.js</a></p>
<p><a href="https://github.com/amsul/pickadate.js">View it on Github</a></p>
</section>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><small><small class="dimmed">wassup kids!</small></small>
<script src="http://code.jquery.com/jquery-1.8.2.min.js"></script>
<script src="pickadate.js"></script>
<script type="text/javascript">
$( '#input_01' ).datepicker()
$( '#input_02' ).datepicker({
month_prev: '←',
month_next: '→',
weekdays_short: [ 'Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa' ],
show_months_full: false
})
$( '#input_03' ).datepicker({
format: 'dddd, dd/mm/yyyy'
})
$( '#input_04' ).datepicker({
disable_picker: true
})
$( '#input_05' ).datepicker({
date_min: false,
date_max: 5
})
$( '#input_06' ).datepicker()
</script>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36321179-2']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>