diff --git a/LICENSE b/LICENSE index 664d8fb..b0037eb 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2023-2025, Kody (rita.moe) +Copyright (c) 2023-2026, Kody (rita.moe) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/browserconfig.xml b/browserconfig.xml index e7e332c..ab6f83e 100644 --- a/browserconfig.xml +++ b/browserconfig.xml @@ -1,9 +1,9 @@ - - - - #111111 - - + + + + #111111 + + diff --git a/css/styles.css b/css/styles.css index 8d43a66..030b408 100644 --- a/css/styles.css +++ b/css/styles.css @@ -1 +1 @@ -body{background-color:#efefef;color:#000;font-family:"Trebuchet MS","Lucida Sans Unicode","Lucida Grande","Lucida Sans",Arial,sans-serif;margin:0 auto;max-width:900px}header{background-color:#fff;border-radius:10px;margin:1rem .5rem 0;padding:1rem 1.5rem}header h1{font-size:1.5rem;margin:0}@media screen and (min-width: 500px){header h1{font-size:2rem}}header a{color:inherit;text-decoration:none}header svg{height:1.7rem;vertical-align:-0.3rem;width:1.7rem}@media screen and (min-width: 500px){header svg{height:2rem;width:2rem}}main{padding:1rem 2rem}main h2{font-size:1.5rem;margin:1rem 0;text-align:center}main h2 span{font-size:1.2rem}main form{line-height:2rem}main form label{cursor:pointer;margin-right:.2rem}@media screen and (max-width: 499px){main form label{display:block}main form input,main form select{width:100%}}main button{cursor:pointer;margin-top:1rem}main .tz-table{display:flex;flex-wrap:wrap;justify-content:center;text-align:center}main .tz-table .tz-table-element{flex:0 0 calc(100% - 1rem);margin:.5rem}@media screen and (min-width: 440px){main .tz-table .tz-table-element{flex:0 0 calc(50% - 1rem)}}@media screen and (min-width: 630px){main .tz-table .tz-table-element{flex:0 0 calc(33% - 1rem)}}@media screen and (min-width: 820px){main .tz-table .tz-table-element{flex:0 0 calc(25% - 1rem)}}main .share{margin-top:1rem;text-align:center}footer{color:#444;font-size:.7rem;margin-top:1rem;padding:1rem;text-align:center}footer a{color:inherit}@media screen and (prefers-color-scheme: dark){body{background-color:#111;color:#fff}header{background-color:#000}footer{color:#b5b5b5}}/*# sourceMappingURL=styles.css.map */ +body{background-color:#efefef;color:#000;font-family:"Trebuchet MS","Lucida Sans Unicode","Lucida Grande","Lucida Sans",Arial,sans-serif;margin:0 auto;max-width:900px}header{background-color:#fff;border-radius:10px;margin:1rem .5rem 0;padding:1rem 1.5rem}header h1{font-size:1.5rem;margin:0}@media screen and (min-width: 500px){header h1{font-size:2rem}}header a{color:inherit;text-decoration:none}header svg{height:1.7rem;vertical-align:-0.3rem;width:1.7rem}@media screen and (min-width: 500px){header svg{height:2rem;width:2rem}}main{padding:1rem 2rem}main h2{font-size:1.5rem;margin:1rem 0;text-align:center}main h2 span{font-size:1.2rem}main form{line-height:2rem}main form label{cursor:pointer;margin-right:.2rem}@media screen and (max-width: 499px){main form label{display:block}main form input,main form select{width:100%}}main button{cursor:pointer;margin-top:1rem}main hr{margin:3rem 0}main .tz-table{display:flex;flex-wrap:wrap;justify-content:center;text-align:center}main .tz-table .tz-table-element{flex:0 0 calc(100% - 1rem);margin:.5rem}@media screen and (min-width: 440px){main .tz-table .tz-table-element{flex:0 0 calc(50% - 1rem)}}@media screen and (min-width: 630px){main .tz-table .tz-table-element{flex:0 0 calc(33% - 1rem)}}@media screen and (min-width: 820px){main .tz-table .tz-table-element{flex:0 0 calc(25% - 1rem)}}main .share{margin-top:1rem;text-align:center}footer{color:#444;font-size:.7rem;margin-top:1rem;padding:1rem;text-align:center}footer a{color:inherit}@media screen and (prefers-color-scheme: dark){body{background-color:#111;color:#fff}header{background-color:#000}footer{color:#b5b5b5}}/*# sourceMappingURL=styles.css.map */ diff --git a/css/styles.css.map b/css/styles.css.map index 8dbefb7..51e813d 100644 --- a/css/styles.css.map +++ b/css/styles.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA,KACE,yBACA,WACA,gGACA,cACA,gBAGF,OACE,sBACA,mBACA,oBACA,oBAEA,UACE,iBACA,SAEA,qCAJF,UAKI,gBAIJ,SACE,cACA,qBAGF,WACE,cACA,uBACA,aAEA,qCALF,WAMI,YACA,YAKN,KACE,kBAEA,QACE,iBACA,cACA,kBAEA,aACE,iBAIJ,UACE,iBAEA,gBACE,eACA,mBAGF,qCACE,gBACE,cAGF,iCAEE,YAKN,YACE,eACA,gBAGF,eACE,aACA,eACA,uBACA,kBAIA,iCACE,2BACA,OAJQ,MAMR,qCAJF,iCAKI,2BAGF,qCARF,iCASI,2BAGF,qCAZF,iCAaI,2BAKN,YACE,gBACA,kBAIJ,OACE,WACA,gBACA,gBACA,aACA,kBAEA,SACE,cAIJ,+CACE,KACE,sBACA,WAGF,OACE,sBAGF,OACE","file":"styles.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["styles.scss"],"names":[],"mappings":"AAAA,KACE,yBACA,WACA,gGACA,cACA,gBAGF,OACE,sBACA,mBACA,oBACA,oBAEA,UACE,iBACA,SAEA,qCAJF,UAKI,gBAIJ,SACE,cACA,qBAGF,WACE,cACA,uBACA,aAEA,qCALF,WAMI,YACA,YAKN,KACE,kBAEA,QACE,iBACA,cACA,kBAEA,aACE,iBAIJ,UACE,iBAEA,gBACE,eACA,mBAGF,qCACE,gBACE,cAGF,iCAEE,YAKN,YACE,eACA,gBAGF,QACE,cAGF,eACE,aACA,eACA,uBACA,kBAIA,iCACE,2BACA,OAJQ,MAMR,qCAJF,iCAKI,2BAGF,qCARF,iCASI,2BAGF,qCAZF,iCAaI,2BAKN,YACE,gBACA,kBAIJ,OACE,WACA,gBACA,gBACA,aACA,kBAEA,SACE,cAIJ,+CACE,KACE,sBACA,WAGF,OACE,sBAGF,OACE","file":"styles.css"} \ No newline at end of file diff --git a/css/styles.scss b/css/styles.scss index a0718c4..59a4002 100644 --- a/css/styles.scss +++ b/css/styles.scss @@ -1,7 +1,8 @@ body { background-color: #efefef; color: #000; - font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', 'Lucida Sans', Arial, sans-serif; + font-family: 'Trebuchet MS', 'Lucida Sans Unicode', 'Lucida Grande', + 'Lucida Sans', Arial, sans-serif; margin: 0 auto; max-width: 900px; } @@ -76,6 +77,10 @@ main { margin-top: 1rem; } + hr { + margin: 3rem 0; + } + .tz-table { display: flex; flex-wrap: wrap; diff --git a/index.php b/index.php index bb9fe22..5d49766 100644 --- a/index.php +++ b/index.php @@ -1,11 +1,12 @@ format('T'); - return str_starts_with($offset, '-') || str_starts_with($offset, '+') ? 'UTC' . $offset : $offset; + return (str_starts_with($offset, '-') || str_starts_with($offset, '+')) + ? 'UTC' . $offset + : $offset; } function toTZ($dt, $tz, $format='Y-m-d H:i') { @@ -39,6 +42,8 @@ $popTZ = [ ]; $allTZ = timezone_identifiers_list(DateTimeZone::ALL); +$currPageEncoded = htmlspecialchars(SITE_BASE . $_SERVER['REQUEST_URI'], + ENT_QUOTES, 'UTF-8'); // User sets timezone cookie if (isset($_POST['user-tz']) && in_array($_POST['user-tz'], $allTZ)) { @@ -60,7 +65,8 @@ try { if (isset($_POST['datetime']) && isset($_POST['timezone'])) { // -- Redirect to submitted date // @NOTE(Kody): I'm fine not validating all inputs here. - // Either it will fall in the catch block, or fail at the validation after the redirect. + // Either it will fall in the catch block, or fail at + // the validation after the redirect. // Handle if timezone is an offset $postTZ = $_POST['timezone']; @@ -106,7 +112,13 @@ try { - Time Zones Are Hard<?= isset($req) ? ' - ' . htmlspecialchars(str_replace('_', '+', $req), ENT_QUOTES, 'UTF-8') : '' ?> + Time Zones Are Hard<?= + isset($req) + ? ' - ' . htmlspecialchars( + str_replace('_', '+', $req), ENT_QUOTES, 'UTF-8' + ) + : '' + ?> @@ -126,7 +138,12 @@ try {
-

Time Zones Are Hard

+

+ + + Time Zones Are Hard + +

@@ -135,186 +152,24 @@ try {
- -

- -

- -
- -

In popular time zones

-
- -
- -
- -
- -
- -
- -
- - - -

- Fill out this form to make a page that shows a set date and time in the visitor's time zone.
- It will also show the time in other popular time zones. -

- -
- - - - -
- - - - -
- - -
- - -
diff --git a/pages/dt.php b/pages/dt.php new file mode 100644 index 0000000..2c88ceb --- /dev/null +++ b/pages/dt.php @@ -0,0 +1,145 @@ + +

+ +

+ +
+ +

In popular time zones

+
+ +
+ +
+ +
+ +
+ +
+ +
+ + \ No newline at end of file diff --git a/pages/home.php b/pages/home.php new file mode 100644 index 0000000..c74271d --- /dev/null +++ b/pages/home.php @@ -0,0 +1,72 @@ + +

+ Fill out this form to make a page that shows a set date and time in + the visitor's time zone.
+ It will also show the time in other popular time zones. +

+ +
+ + + + +
+ + + + +
+ + +
+ +
+ +

Current time

+
+ +
+ +
+ +
+ +
+ + \ No newline at end of file diff --git a/routing.php b/routing.php index cbc40a2..3a8127c 100644 --- a/routing.php +++ b/routing.php @@ -3,7 +3,10 @@ // php -S 127.0.0.1:8080 routing.php // Check for static files but exclude dot files -if (is_file($_SERVER['DOCUMENT_ROOT'] . '/' . $_SERVER['SCRIPT_NAME']) && strpos($_SERVER['SCRIPT_NAME'], '/.') === false) { +if ( + is_file($_SERVER['DOCUMENT_ROOT'] . '/' . $_SERVER['SCRIPT_NAME']) && + strpos($_SERVER['SCRIPT_NAME'], '/.') === false +) { return false; } diff --git a/site.webmanifest b/site.webmanifest index 4fa059f..dd71785 100644 --- a/site.webmanifest +++ b/site.webmanifest @@ -1,38 +1,38 @@ { - "id": "/", - "start_url": "/", - "name": "Time Zones Are Hard", - "short_name": "TZAH", - "display": "standalone", - "orientation": "portrait-primary", - "categories": [ - "utilities", - "productivity" - ], - "theme_color": "#111111", - "background_color": "#111111", - "icons": [ - { - "src": "/img/android-chrome-192x192.png", - "sizes": "192x192", - "type": "image/png" - }, - { - "src": "/img/maskable_icon_x192.png", - "sizes": "192x192", - "type": "image/png", - "purpose": "maskable" - }, - { - "src": "/img/android-chrome-512x512.png", - "sizes": "512x512", - "type": "image/png" - }, - { - "src": "/img/maskable_icon_x512.png", - "sizes": "512x512", - "type": "image/png", - "purpose": "maskable" - } - ] + "id": "/", + "start_url": "/", + "name": "Time Zones Are Hard", + "short_name": "TZAH", + "display": "standalone", + "orientation": "portrait-primary", + "categories": [ + "utilities", + "productivity" + ], + "theme_color": "#111111", + "background_color": "#111111", + "icons": [ + { + "src": "/img/android-chrome-192x192.png", + "sizes": "192x192", + "type": "image/png" + }, + { + "src": "/img/maskable_icon_x192.png", + "sizes": "192x192", + "type": "image/png", + "purpose": "maskable" + }, + { + "src": "/img/android-chrome-512x512.png", + "sizes": "512x512", + "type": "image/png" + }, + { + "src": "/img/maskable_icon_x512.png", + "sizes": "512x512", + "type": "image/png", + "purpose": "maskable" + } + ] }