forked from joshsalverda/datepickr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
82 lines (66 loc) · 3.06 KB
/
index.html
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
<!DOCTYPE html>
<html>
<head>
<title>Sample datepickrs</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="src/datepickr.min.css">
<style>
body {
font-family: Verdana;
}
h1 {
font-size: 25px;
}
.calendar-icon {
display: inline-block;
vertical-align: middle;
width: 32px;
height: 32px;
background: url(images/calendar.png);
}
input {
border: 1px solid #aaa;
padding: 5px;
width: 300px;
}
</style>
</head>
<body>
<h1>datepickr examples</h1>
<p><input id="datepickr" placeholder="Nothin' special"></p>
<p><input class="datepickr" placeholder="Custom formatting"></p>
<p><input id="minAndMax" placeholder="Min and max date options"></p>
<p>
<span class="calendar-icon"></span>
<input id="calendar-input" placeholder="Click on my fancy icon">
</p>
<p><input title="parseMe" value="January 1, 3000" placeholder="Welcome to the world of tomorrow!"></p>
<p><input id="someFrench" class="sil-vous-plait" placeholder="En francais"></p>
<script src="src/datepickr.min.js"></script>
<script>
// Regular datepickr
datepickr('#datepickr');
// Custom date format
datepickr('.datepickr', { dateFormat: 'd-m-Y'});
// Min and max date
datepickr('#minAndMax', {
// few days ago
minDate: new Date().getTime() - 2.592e8,
// few days from now
maxDate: new Date().getTime() + 2.592e8
});
// datepickr on an icon, using altInput to store the value
// altInput must be a direct reference to an input element (for now)
datepickr('.calendar-icon', { altInput: document.getElementById('calendar-input') });
// If the input contains a value, datepickr will attempt to run Date.parse on it
datepickr('[title="parseMe"]');
// Overwrite the global datepickr prototype
// Won't affect previously created datepickrs, but will affect any new ones
datepickr.prototype.l10n.months.shorthand = ['janv', 'févr', 'mars', 'avril', 'mai', 'juin', 'juil', 'août', 'sept', 'oct', 'nov', 'déc'];
datepickr.prototype.l10n.months.longhand = ['janvier', 'février', 'mars', 'avril', 'mai', 'juin', 'juillet', 'août', 'septembre', 'octobre', 'novembre', 'décembre'];
datepickr.prototype.l10n.weekdays.shorthand = ['dim', 'lun', 'mar', 'mer', 'jeu', 'ven', 'sam'];
datepickr.prototype.l10n.weekdays.longhand = ['dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'];
datepickr('#someFrench.sil-vous-plait', { dateFormat: '\\le j F Y' });
</script>
</body>
</html>