-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.html
More file actions
275 lines (240 loc) · 12.3 KB
/
index.html
File metadata and controls
275 lines (240 loc) · 12.3 KB
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
<!DOCTYPE html>
<html lang="en">
<head>
<!-- YOU'RE AWESOME! HAVE FUN USING DATABLE AND MAKE SURE TO STAR IT ON GITHUB! -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Datable Demo</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<style>
.navbar-brand {
padding:0 15px;
}
#theForm {
padding:10px;
}
#theForm input {
margin-bottom:15px;
max-width:150px;
}
fieldset {
padding-bottom:30px;
}
.row {
margin-bottom:50px;
}
#fork {
position: fixed;
top:50px;
right:0;
z-index: 500;
}
</style>
</head>
<body>
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
<div class="container">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<a class="navbar-brand" href="#">
<img src="logo.gif" alt="">
</a>
</div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<a href="#demo">Demo</a>
</li>
<li>
<a href="#install">Install</a>
</li>
<li>
<a href="#download">Download</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container -->
</nav>
<div id="fork">
<a href="https://github.com/invot/datable.js/"><img src="fork.png" /></a>
</div>
<!-- Page Content -->
<div class="container">
<hr />
<div class="row">
<div class="col-lg-12">
<h1>Datable</h1><a name="demo"></a>
<p>A lightweight, customizable, bootstraps-friendly jQuery plugin to properly format dates in inputs and verify that the date is valid.</p>
<div class="alert alert-danger" role="alert">Version 0.5.0 and beyond will not work with any previous version. Every decimal release will be feature-breaking until version 1.0 is released. With that said, this new version is faster and easier to use, so give it a try!</div>
</div>
<hr />
</div>
<div class="row">
<div class="col-lg-12">
<h3>Demo</h3>
<form id="theForm">
<fieldset id="full-date">
<legend>Full Date</legend>
<div class="row">
<div class="col-lg-6 control-group">
<label class="control-label">Default Settings</label>
<input id="input0" type="datable" class="form-control" />
<p><code>
<input type="datable" />
</code></p>
</div>
<div class="col-lg-6 control-group">
<br />
<p>By simply adding <code>type="datable"</code> to any input field, datable.js will transform your plain ol' input field into a datable input!</p>
</div>
</div>
<div class="row">
<div class="col-lg-6 control-group">
<label class="control-label">2-digit year (US)</label>
<input id="input3" type="datable" class="form-control" data-datable="mmddyy" />
<p><code>
<input type="datable" data-datable="mmddyy" />
</code></p>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">Standard (UK)</label>
<input id="input4" type="datable" class="form-control" data-datable="ddmmyyyy" />
<p><code>
<input type="datable" data-datable="ddmmyyyy" />
</code></p>
</div>
</div>
</fieldset>
<fieldset id="month-year">
<legend>Month & Year</legend>
<div class="col-lg-6 control-group">
<label class="control-label">Standard (US)</label>
<div class="controls">
<input id="input1" type="datable" class="form-control" data-datable="mmyyyy" />
</div>
<p><code>
<input type="datable" data-datable="mmyyyy" />
</code></p>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">2-digit (UK)</label>
<div class="controls">
<input id="input2" type="datable" class="form-control" data-datable="yymm" />
</div>
<p><code>
<input type="datable" data-datable="yymm" />
</code></p>
</div>
</fieldset>
<fieldset id="alternate">
<legend>Alternate Dividers</legend>
<div class="col-lg-6 control-group">
<label class="control-label">Standard (US) with spaced dash</label>
<input id="input5" type="datable" class="form-control" data-datable="mmddyyyy" data-datable-divider=" - " />
<p><code>
<input type="datable" data-datable="mmddyyyy" data-datable-divider=" - " />
</code></p>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">Standard (UK) with dash</label>
<input id="input6" type="datable" class="form-control" data-datable="ddmmyyyy" data-datable-divider="-" />
<p><code>
<input type="datable" data-datable="ddmmyyyy" data-datable-divider="-" />
</code></p>
</div>
</fieldset>
<fieldset id="era">
<legend>Era Validation <small>(Does not support 2-digit year)</small></legend>
<div class="panel panel-default col-lg-12">
<div class="panel-body">
<p>Uses <code>data-datable-era</code> and <code>data-datable-era2</code> to create two points in time. If <code>data-datable-era2</code> is left blank then the second point in time is the current date.</p>
<p>Two formats are accepted. If you want to select a percise date, enter in <code>"yyyy,mm,dd"</code>. If you want to enter in a point of time relative to the current date, enter in an array <code>"[yyyy,mm,dd]"</code>. The array can contain positive or negative numbers and be any length. The array MUST have all three values set.</p>
</div>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">Between today and January 1, 2000</label>
<input id="input7" type="datable" class="form-control" data-datable-era="2000,1,1" />
<p><code>
<input type="datable" data-datable-era="2000,1,1" />
</code></p>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">Any day in the 1990s</label>
<input id="input8" type="datable" class="form-control" data-datable-divider="/" data-datable-era="1999,12,31" data-datable-era2="1990,1,1" />
<p><code>
<input type="datable" data-datable-divider="/" data-datable-era="1999,12,31" data-datable-era2="1990,1,1" />
</code></p>
</div>
<p> </p>
<div class="col-lg-6 control-group">
<label class="control-label">Within the next 30 days</label>
<input id="input9" type="datable" class="form-control" type="datable" data-datable="yyyymmdd" data-datable-era="[0,0,30]" />
<p><code>
<input type="datable" data-datable="yyyymmdd" data-datable-era="[0,0,30]" />
</code></p>
</div>
<div class="col-lg-6 control-group">
<label class="control-label">Between 10 and 20 years ago</label>
<input id="input10" type="datable" class="form-control" data-datable="ddmmyyyy" data-datable-era="[-10,0,0]" data-datable-era2="[-20,0,0]" />
<p><code>
<input type="datable" data-datable="ddmmyyyy" data-datable-era="[-10,0,0]" data-datable-era2="[-20,0,0]" />
</code></p>
</div>
</fieldset>
</form>
<div class="row">
<div class="col-lg-12">
<legend>Future Features</legend>
<ul>
<li>More default values for era validation</li>
<li>Auto-populating dates into the fields</li>
<li>Moment.js support</li>
<li>Cross-field validation (is one date before or after anoter, etc.)</li>
</ul>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Install</h3><a name="install"></a>
<p>After downloading datable, just include the file right above the closing <code><body></code> tag in your HTML.</p>
<p><code>
<script type="text/javascript" src="datable.min.js"></script>
</code></p>
<p>Then initialize the plugin:</p>
<p><code>
$.datable('init');
</code></p>
<p>That's all!</p>
<p> </p>
<p>If you want to clear ALL the datable fields:</p>
<p><code>
$.datable('clearAll');
</code></p>
<p> </p>
<p>And if you want to deinitialize the plugin (this does not clear the values):</p>
<p><code>
$.datable('deinit');
</code></p>
</div>
</div>
<div class="row">
<div class="col-lg-12">
<h3>Download</h3><a name="download"></a>
<p>Available on <a href="https://github.com/invot/datable.js/">github</a>!</p>
</div>
</div>
</div>
<!-- /.container -->
<script type="text/javascript" src="datable.js"></script>
<script>$.datable();</script>
</body>
</html>