-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
50 lines (50 loc) · 2.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
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>human-date-parser</title>
<link rel='stylesheet' type='text/css' href='//cdnjs.cloudflare.com/ajax/libs/semantic-ui/1.12.2/semantic.min.css'>
<script type='text/javascript' src='human-date-parser.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js'></script>
<script type='text/javascript' src='//cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js'></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function () {
$(document).on("change keyup", "input", function () {
var input = $(this);
var value = input.val();
var output = HumanDate.parse(value);
var outputContainer = input.parent().siblings().first().find("input");
outputContainer.val(output.format("LLLL"))
});
$.getJSON("test/inputs.json", function (data) {
for (var key in data) {
var inputs = data[key];
for (input in inputs) {
var row = $("<div class='ui two column row'/>").appendTo("#examples");
var inputContainer = $("<div class='ui column'/>").appendTo(row);
var outputContainer = $("<div class='ui column'><input type='text' disabled='disabled'/></div>").appendTo(row);
var input = $("<input type='text' class='ui' value='" + input + "'/>");
input.appendTo(inputContainer).trigger("change");
}
}
});
});
</script>
</head>
<body>
<form class='ui page vertically padded grid form' id='examples'>
<div class='ui one column row'>
<div class='ui column'>
<h1 class='ui huge header'>human date</h1>
</div>
</div>
</form>
<div class='ui page grid'>
<div class='ui one right aligned column row'>
<div class='ui column'>
<a href='https://github.com/jmtoball/human-date-parser'>human-date-parser</a> by <a href='http://jmtoball.github.io/'>jmtoball</a>
</div>
</div>
</div>
</body>
</html>