diff --git a/images/logo.png b/images/logo.png new file mode 100644 index 0000000..5212fb1 Binary files /dev/null and b/images/logo.png differ diff --git a/images/screenshot.jpg b/images/screenshot.jpg new file mode 100644 index 0000000..ffdd66c Binary files /dev/null and b/images/screenshot.jpg differ diff --git a/index.html b/index.html index 82ca896..3bcc74f 100644 --- a/index.html +++ b/index.html @@ -6,8 +6,15 @@ Timestamp Generator and Converter + + + +
-

Converter and timestamp generator

+

Timestamp Converter

@@ -59,32 +66,6 @@

Convert Timestamp To Date

- -
- -
-

Convert Date to Timestamp

- - - -
diff --git a/scripts.js b/scripts.js index e95c382..4f2a5cd 100644 --- a/scripts.js +++ b/scripts.js @@ -25,33 +25,15 @@ function convertTimestampToDate(timestamp) { "input-convert-timestamp-to-date", ); - const date = new Date(parseInt(timestampInput.value) * 1000); - const localizedDate = date.toLocaleString().replace(",", ""); + const date = new Date(parseInt(timestamp || timestampInput.value) * 1000); + const localizedDate = date + .toLocaleString("sv", { timeZoneName: "short" }) + .replace(",", ""); resultButton.textContent = localizedDate; return localizedDate; } -function convertDateToTimestamp() { - const resultButton = document.getElementById( - "result-button-convert-date-to-timestamp", - ); - const timestampInput = document.getElementById( - "input-convert-date-to-timestamp", - ); - - const formattedDate = new Date( - timestampInput.value.replace("p.m.", "PM").replace("a.m.", "AM"), - ); - const timestamp = formattedDate.getTime() / 1000; - - if (Number.isNaN(timestamp)) { - return alert("Please enter a valid date!"); - } - - resultButton.textContent = timestamp; -} - const resultButtons = document.querySelectorAll(".result-button"); resultButtons.forEach((button) => { diff --git a/styles.css b/styles.css index 8e140f6..368638a 100644 --- a/styles.css +++ b/styles.css @@ -13,6 +13,7 @@ } body { + font-family: "Ubuntu Mono", monospace; font-weight: 400; font-style: normal; @@ -36,7 +37,7 @@ header { main { padding: 10vw; - padding-top: 4vh; + padding-top: 5vh; display: flex; flex-direction: column; justify-content: center;