Skip to content

Commit

Permalink
compatible with APIHariLibur_V4
Browse files Browse the repository at this point in the history
  • Loading branch information
Am K committed May 30, 2023
1 parent 55437fb commit a1c30d5
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions TanggalMerah.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit a1c30d5

Please sign in to comment.