From a1c30d599584fac254ec2d4150f6a58bd21401ef Mon Sep 17 00:00:00 2001 From: Am K Date: Wed, 31 May 2023 00:09:04 +0700 Subject: [PATCH] compatible with APIHariLibur_V4 --- TanggalMerah.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/TanggalMerah.php b/TanggalMerah.php index 14ebf2d..4a39531 100644 --- a/TanggalMerah.php +++ b/TanggalMerah.php @@ -28,7 +28,7 @@ public function __construct(string $local = null) $this->event = []; $this->date = new DateTime("now", $tz); if (!isset($local)) { - $r = file_get_contents("https://github.com/guangrei/Json-Indonesia-holidays/raw/master/calendar.json"); + $r = file_get_contents("https://raw.githubusercontent.com/guangrei/APIHariLibur_V2/main/calendar.min.json"); $this->data = json_decode($r, true); } else { $r = file_get_contents($local); @@ -61,9 +61,8 @@ public function is_sunday() : bool public function is_holiday() : bool { - $check = isset($this->data[$this->date->format("Ymd")])?true:false; - if ($check) { - $this->event[] = $this->data[$this->date->format("Ymd")]['deskripsi']; + if (isset($this->data[$this->date->format("Y-m-d")]) && $this->data[$this->date->format("Y-m-d")]['holiday']) { + $this->event[] = implode(" | ", $this->data[$this->date->format("Y-m-d")]['summary']); return true; } else { return false;