-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.gohtml
88 lines (87 loc) · 3.89 KB
/
index.gohtml
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Unix Timestamp Converter</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://unpkg.com/[email protected]" integrity="sha384-0895/pl2MU10Hqc6jd4RvrthNlDiE9U1tWmX7WRESftEDRosgxNsQG/Ze9YMRzHq" crossorigin="anonymous"></script>
</head>
<body class="container bg-light" style="width: 600px;">
<h1 class="mb-3 gy-4 text-center">Unix Timestamp Converter</h1>
<h3 class="mb-3 text-primary">Epoch Time → Human Readable</h3>
<form>
<label for="epochInput" class="form-label card-title">Enter Epoch Time (in seconds)</label>
<div class="row g-1">
<div class="col">
<input type="text" name="seconds" class="form-control" id="epochInput" hx-post="/epoch/" hx-target="#results-table" value='{{ .Epoch }}'>
</div>
<div class="col-auto">
<select class="form-select" aria-label="Result Format" name="result-format" hx-post="/epoch/" hx-target="#results-table">
<option value="RFC3339">RFC3339</option>
<option value="RFC822">RFC822</option>
<option value="RFC850">RFC850</option>
<option value="RFC1123">RFC1123</option>
<option value="Unix">Unix</option>
<option value="ANSIC">ANSIC</option>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary" hx-post="/epoch/" hx-target="#results-table">Submit</button>
</div>
</div>
</form>
{{ block "table" . }}
{{ if .Valid }}
<div class="mb-3 width-auto" id="results-table">
<table class="table table-bordered mt-3">
<tbody>
<tr>
<td>{{ .Local }}</td><td>local</td>
</tr>
<td>{{ .UTC }}</td><td>UTC</td>
</tbody>
</table>
{{ end }}
{{ end }}
</div>
<hr>
<form>
<h3 class="mb-3 text-primary">Human Readable → Epoch Time</h3>
<label for="timestampInput" class="form-label">Enter timestamp</label>
<div class="row g-1">
<div class="col">
<input type="text" name="timestamp" class="form-control" id="timestampInput" hx-post="/timestamp/" hx-target="#epoch-result" placeholder='{{ .Local }}'>
</div>
<div class="col-auto">
<select class="form-select" aria-label="Input Format" name="input-format" hx-post="/timestamp/" hx-target="#epoch-result">
<option value="RFC3339">RFC3339</option>
<option value="RFC822">RFC822</option>
<option value="RFC850">RFC850</option>
<option value="RFC1123">RFC1123</option>
<option value="Unix">Unix</option>
<option value="ANSIC">ANSIC</option>
</select>
</div>
<div class="col-auto">
<button type="submit" class="btn btn-primary" hx-post="/timestamp/" hx-target="#epoch-result">Submit</button>
</div>
</div>
</form>
{{ block "timestamp" . }}
{{ if .Valid }}
<div class="mb-3 width-auto" id="epoch-result">
<h5 class="mb-3 gy-2">{{ .Epoch }} seconds</h5>
</div>
{{ else }}
<div class="mb-3 width-auto" id="epoch-result">
<h5 class="mb-3 gy-2" style="color: red;">Invalid Timestamp</h5>
</div>
{{ end }}
{{ end }}
<div class="text-center">
<a href="https://github.com/aldernero/unixtime" class="text-secondary">Github</a>
</div>
</body>
</html>