Time Zones Are Hard - https://tz.rita.moe

Formating and update comments

[skip ci]

Changed files
+11 -11
css
+2 -2
README.md
···
-
# Time Zones are hard
+
# Time Zones Are Hard
> But this site is simple
···
# Build CSS, you can add `--watch` too
sass -s compressed css/
-
# Run dev PHP server
+
# Run local PHP server
php -S 127.0.0.1:8080 routing.php
```
+3 -3
css/styles.scss
···
button {
cursor: pointer;
}
-
+
.tz-table {
display: flex;
flex-wrap: wrap;
···
@media screen and (min-width: 440px) {
flex: 0 0 calc(50% - ($spacing * 2));
}
-
+
@media screen and (min-width: 630px) {
flex: 0 0 calc(33% - ($spacing * 2));
}
-
+
@media screen and (min-width: 820px) {
flex: 0 0 calc(25% - ($spacing * 2));
}
+6 -6
index.php
···
$_COOKIE['user-24'] = '1';
}
-
// If had JS enabled but doesn't now, remove cookie
+
// If had JS enabled but doesn't now, set has-js to 0
if (isset($_POST['no-js'])) {
setcookie('has-js', '0', time() + 60 * 60 * 24 * 365);
$_COOKIE['has-js'] = '0';
···
$h = str_pad(abs(intdiv($postTZ, 60)), 2, '0', STR_PAD_LEFT);
$m = str_pad($postTZ % 60, 2, '0', STR_PAD_LEFT);
$postTZ = ($isNeg ? '-' : '+') . $h . $m;
-
}
+
}
// Make our date object
$dateObj = new DateTime($_POST['datetime'], new DateTimeZone($postTZ));
···
$hm = $_COOKIE['user-24'] === '1' ? 'H:i' : 'h:i a';
// I put spaces just so it looks nice in the source code
echo ' ' . toTZ($dt, $_COOKIE['user-tz'], 'l \t\h\e jS \o\f F, Y \a\t ' . $hm) . PHP_EOL;
-
} else if($_COOKIE['has-js'] !== '1') {
+
} else if ($_COOKIE['has-js'] !== '1') {
?>
Sorry, we use JavaScript to detect your local time.<br/>
Enable it or select your time zone:<br/>
···
// Display
document.querySelector('.local').innerHTML = localDT + '<br/><span>(' + relative + ')</span>'
-
// Enable share button
+
// Display share button
document.querySelector('.share').style.display = 'block'
-
+
// Our share URL function
function shareURL () {
if (navigator.canShare) {
···
</footer>
<script>
-
// Save on the request size if user has JavaScript
+
// Save on the document size if user has JavaScript
const date = new Date()
date.setTime(date.getTime() + (1000 * 60 * 60 * 24 * 365))
document.cookie = 'has-js=1; expires=' + date.toUTCString() + '; path=/'