-
Notifications
You must be signed in to change notification settings - Fork 0
/
index_template.html
70 lines (62 loc) · 2.76 KB
/
index_template.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Gives the time/session details for the next race and previous races">
<meta name="author" content="Oliver Dimes">
<title>What time is F1?</title>
<!-- Bootstrap core CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
<!-- Custom styles for this template -->
<link href="cover.css" rel="stylesheet">
</head>
<body class="text-center" data-new-gr-c-s-check-loaded="14.1027.0" data-gr-ext-installed="">
<div class="cover-container d-flex h-100 p-3 mx-auto flex-column">
<header class="masthead mb-auto">
<div class="inner">
<h3 class="masthead-brand">What Time is F1?</h3>
<nav class="nav nav-masthead justify-content-center">
<a class="nav-link active" href="#">Home</a>
<a class="nav-link" href="https://github.com/effeect">Github</a>
</nav>
</div>
</header>
<main role="main" class="inner cover">
<h1 class="cover-heading">Next Grand Prix is the {{ event }}</h1>
<h2 class="cover-heading">Hosted in {{ country }}, {{ location }}</h2>
<table class="table">
<thead class="thead-primary">
<tr>
<th>Session Name</th>
<th>Time</th>
</tr>
</thead>
{{ table }}
</table>
</main>
<footer class="mastfoot mt-auto">
<div class="cover-container">
<p>Hosted on Github Pages, Cover template based on the example on <a href="https://getbootstrap.com/">Bootstrap</a>, by <a href="https://twitter.com/mdo">@mdo</a>.</p>
</div>
</footer>
</div>
<script>
function stringToDate(dateString) {
// Split the date and time parts
const [datePart, timePart] = dateString.split(' ');
// Split the date part into year, month, and day
const [year, month, day] = datePart.split('-').map(Number);
// Split the time part into hours, minutes, and seconds
const [hours, minutes, seconds] = timePart.split(':').map(Number);
// Create and return the Date object
return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
}
// Taking values from Jinja Script
let elements = document.querySelectorAll('[data-id="time"]');
for(x = 0; x < elements.length; x++){
let timeobject = stringToDate(elements[x].textContent)
elements[x].textContent = timeobject.toDateString() + " " + timeobject.toLocaleTimeString()
}
</script>
</body>