Skip to content

Commit

Permalink
feat: make function modern, improve minify
Browse files Browse the repository at this point in the history
  • Loading branch information
AstreaTSS committed Feb 6, 2024
1 parent 3a04ca0 commit 9fc08dc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/minify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/checkout@v3

- name: HTML/CSS/JS Minifier
uses: docker://devatherock/minify-js:1.0.3
uses: devatherock/minify-js@v3.0.0
with:
add_suffix: false

Expand Down
10 changes: 4 additions & 6 deletions timezone.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@
// so what's here might not be amazing
// but it should be fine

function getTZName(type) {
const tzName = (type) => {
const DTFormat = new Intl.DateTimeFormat([], { "timeZoneName": type });
const tzName = DTFormat
.formatToParts(Date.now())
.find((m) => m.type === "timeZoneName");
return tzName.value;
}

document.getElementById("timezone").innerText = "Your time zone is: " + getTZName("short")
document.getElementById("fullname").innerText = "Full name: " + getTZName("long")

const ianaName = new Intl.DateTimeFormat().resolvedOptions().timeZone;
document.getElementById("iananame").innerHTML = "IANA name: " + ianaName;
document.getElementById("timezone").innerText = "Your time zone is: " + tzName("short")
document.getElementById("fullname").innerText = "Full name: " + tzName("long")
document.getElementById("iananame").innerHTML = "IANA name: " + (new Intl.DateTimeFormat().resolvedOptions().timeZone);

0 comments on commit 9fc08dc

Please sign in to comment.