First pass at systime app
This commit is contained in:
10
content/extras/date/_index.md
Normal file
10
content/extras/date/_index.md
Normal file
@ -0,0 +1,10 @@
|
||||
---
|
||||
title: Systime Date Converter
|
||||
---
|
||||
|
||||
<div id="converter">
|
||||
<input type="text" class="systime">
|
||||
⇄
|
||||
<input type="datetime-local" class="date">
|
||||
</div>
|
||||
<script src="convert.js"></script>
|
||||
21
content/extras/date/convert.ts
Normal file
21
content/extras/date/convert.ts
Normal file
@ -0,0 +1,21 @@
|
||||
class Systime {
|
||||
year: number;
|
||||
dayOfYear: number;
|
||||
hundredths: number;
|
||||
|
||||
constructor(date: Date) {
|
||||
this.fromDate(date);
|
||||
}
|
||||
|
||||
fromDate(date: Date): void {
|
||||
}
|
||||
|
||||
toDate(): Date {
|
||||
}
|
||||
|
||||
fromString(str: string): void {
|
||||
}
|
||||
|
||||
toString(): string {
|
||||
}
|
||||
};
|
||||
35
content/extras/systime.md
Normal file
35
content/extras/systime.md
Normal file
@ -0,0 +1,35 @@
|
||||
---
|
||||
title: Systime
|
||||
---
|
||||
|
||||
You can use this form to convert to/from [systime](https://wiki.post-self.ink/wiki/Systime).
|
||||
|
||||
<div style="text-align: center;">
|
||||
<input type="text" id="systime" value="systime 1+21" /><br>
|
||||
<input type="button" id="convert" value="Convert systime..." />
|
||||
</div>
|
||||
<div id="output" />
|
||||
<script type="text/javascript">
|
||||
document.getElementById('convert').addEventListener("click", (ev) => {
|
||||
fetch(`https://systime.post-self.ink/api/1/systime/${document.getElementById('systime').value}`)
|
||||
.then((response) => {
|
||||
if (!response.ok) {
|
||||
document.getElementById('output').innerHTML = `Error converting systime`;
|
||||
throw new Error(response.status);
|
||||
}
|
||||
return response.json();
|
||||
})
|
||||
.then((json) => {
|
||||
document.getElementById('output').innerHTML = `
|
||||
<dl>
|
||||
<dt>Systime</dt>
|
||||
<dd>${json.systime.string}</dd>
|
||||
<dt>Gregorian</dt>
|
||||
<dd>${json.gregorian.string}</dd>
|
||||
<dt>Hebrew</dt>
|
||||
<dd>${json.hebrew.string}</dd>
|
||||
</dl>`;
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user