Skip to content

Instantly share code, notes, and snippets.

@heiglandreas
Created April 19, 2023 18:59
Show Gist options
  • Save heiglandreas/763ea6974f4355d12fcddc5f897de24a to your computer and use it in GitHub Desktop.
Save heiglandreas/763ea6974f4355d12fcddc5f897de24a to your computer and use it in GitHub Desktop.
Calendar buddhist
Calendar chinese
int(1)
int(1)
Calendar coptic
Calendar dangi
int(1)
int(1)
Calendar ethiopic
Calendar ethiopic-amete-alem
Calendar gregorian
Calendar hebrew
Calendar indian
int(0)
int(0)
Calendar islamic
Calendar islamic-civil
Calendar islamic-umalqura
Calendar islamic-tbla
Calendar iso8601
Calendar japanese
Calendar persian
int(0)
int(0)
Calendar roc
Calendar buddhist
Calendar chinese
Calendar coptic
Calendar dangi
Calendar ethiopic
Calendar ethiopic-amete-alem
Calendar gregorian
Calendar hebrew
Calendar indian
Calendar islamic
Calendar islamic-civil
Calendar islamic-umalqura
Calendar islamic-tbla
Calendar iso8601
Calendar japanese
Calendar persian
Calendar roc
<?php
// The implementation of the chinese calendar seems to be broken
// The months can not be set.
$calendars = [
"buddhist",
"chinese",
"coptic",
"dangi",
"ethiopic",
"ethiopic-amete-alem",
"gregorian",
"hebrew",
"indian",
"islamic",
"islamic-civil",
"islamic-umalqura",
"islamic-tbla",
"iso8601",
"japanese",
"persian",
"roc",
];
foreach ($calendars as $calendar) {
echo ' Calendar ' . $calendar . PHP_EOL;
$f = IntlCalendar::createInstance('UTC', '@calendar=' . $calendar);
$i = $f->get(IntlCalendar::FIELD_MONTH);
$f->set(IntlCalendar::FIELD_MONTH, 0);
if ($i == $f->get(IntlCalendar::FIELD_MONTH)) {
var_dump($i, $f->get(IntlCalendar::FIELD_MONTH));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment