diff options
| author | ilotterytea <iltsu@alright.party> | 2025-03-27 02:18:42 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-03-27 02:18:42 +0500 |
| commit | f8bef19a9327673ff69b94cce315e5027cb3e0ca (patch) | |
| tree | f5552054eceb4d46ef6d7e8bc6181d546a59ee81 | |
| parent | 4817a5f2e72a29e6f2c7671d5934e78a19184127 (diff) | |
feat: timezone support
| -rw-r--r-- | public/index.php | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/public/index.php b/public/index.php index e181b96..2d7b588 100644 --- a/public/index.php +++ b/public/index.php @@ -1,8 +1,17 @@ <?php include_once "../holidays.php"; -$month = $_GET["month"] ?? date("n"); -$day = $_GET["day"] ?? date("d"); +$time = time(); +$utc = intval($_GET["utc"] ?? ""); + +if (-12 <= $utc && $utc <= 12) { + $time += 60 * 60 * $utc; +} else { + $utc = 0; +} + +$month = $_GET["month"] ?? date("n", $time); +$day = $_GET["day"] ?? date("d", $time); $holidays = []; @@ -24,11 +33,15 @@ $holiday_count = count($holidays); <html> <head> - <title><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?></title> + <title><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?> + <?php echo $utc != 0 ? ("(UTC" . ($utc >= 0 ? "+" : "") . "$utc)") : "" ?> + </title> </head> <body> - <h1><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?></h1> + <h1><?php echo $holiday_count ?> holidays on <?php echo "$day.$month" ?> + <?php echo $utc != 0 ? ("(UTC" . ($utc >= 0 ? "+" : "") . "$utc)") : "" ?> + </h1> <ul> <?php foreach ($holidays as $holiday) { |
