-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
68 lines (48 loc) · 2.53 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
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&display=swap" rel="stylesheet">
<style>*{font-family: Roboto; padding:0; margin:0; transition:0.3s;} body{width:100%; height:100%; display: flex; align-items:center; justify-content: center;}</style>
<title>LiIon Production Date</title>
<div style="display:flex; justify-content:center; align-items:center; flex-direction:column;">
<img src="https://raw.githubusercontent.com/NiklasVoigt/LiIonProductionDate/main/battery.jpg" width="40%"/>
<div>Sony Murata Konion 18650</div>
<br><br>
<span>
<label for="code">Datecode <span style="color: rgb(179, 179, 179);">(12 digits)</span>:</label>
<input type="text" id="code" name="code" placeholder="e.g. 1131587AH27J">
</span>
<br><br>
<button style="padding: 5px;" onclick="sony()">Get Production Date</button>
<br><br>
<div id="date" style="font-weight:bold;"></div>
</div>
<script>
//SONY MURATA KONION 18650 PRODUCTION DATE
function sony() {
var yearsAlphabet = [];
var years = [];
var alphabet = [];
const months = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
for(var i = 23; i < 26; i++) {
yearsAlphabet.push(String.fromCharCode(65 + i));
}
for(var i = 0; i < 23; i++) {
yearsAlphabet.push(String.fromCharCode(65 + i));
}
for(var i = 0; i < 26; i++) {
alphabet.push(String.fromCharCode(65 + i));
years.push(2015+i);
}
if (document.getElementById('code').value.length == 12) {
var day = document.getElementById('code').value.substring(9,11) + "st";
var month = document.getElementById('code').value.charAt(8);
var year = document.getElementById('code').value.charAt(7);
var history = document.getElementById('code').value.charAt(11);
document.getElementById("date").style.color = "green";
document.getElementById("date").innerHTML = day + " " + months[alphabet.indexOf(month)] + " " + years[yearsAlphabet.indexOf(year)] + " with electrode history code " + history;
} else {
document.getElementById("date").style.color = "red";
document.getElementById("date").innerHTML = "Datecode not valid";
}
}
</script>