romme-calendar: add functions to get month/day names from date string

It'll allow the user to get these usefull infos directly from a date string, without having to convert it first
This commit is contained in:
Kazhnuz 2018-11-08 22:22:23 +01:00
parent b9f0a81178
commit b2e49ab064
2 changed files with 63 additions and 1 deletions

View file

@ -46,6 +46,16 @@ $testJulianday = gregoriantojd($testMois, $testJour, $testAnnee);
<strong>romme_getYear :</strong> <?php echo romme_getYear( jdtoromme( $testJulianday ) );?> <br /> <strong>romme_getYear :</strong> <?php echo romme_getYear( jdtoromme( $testJulianday ) );?> <br />
</p> </p>
<h2>Getting the month/day/year… names</h2>
<p>
<strong>romme_getDayName :</strong> <?php echo romme_getDayName( jdtoromme( $testJulianday ) );?> <br />
<strong>romme_getMonthName :</strong> <?php echo romme_getMonthName( jdtoromme( $testJulianday ) );?> <br />
<strong>romme_getDayMonthNames :</strong> <?php echo romme_getDayMonthNames( jdtoromme( $testJulianday ), true );?> <br />
<strong>romme_getComplementaryDay :</strong> <?php echo romme_getComplementaryDay( jdtoromme( $testJulianday ) );?> <br />
<strong>romme_getEpiphany :</strong> <?php echo romme_getEpiphany( jdtoromme( $testJulianday ) );?> <br />
<strong>romme_getComplementaryDayName :</strong> <?php echo romme_getComplementaryDayName( jdtoromme( $testJulianday ) );?> <br />
</p>
<h2>Test des différentes fonctions</h2> <h2>Test des différentes fonctions</h2>
<p> <p>
<strong>gregorian2FrenchDateString :</strong> <?php echo gregoriantoromme_completeString($testMois, $testJour, $testAnnee);?><br /> <strong>gregorian2FrenchDateString :</strong> <?php echo gregoriantoromme_completeString($testMois, $testJour, $testAnnee);?><br />

View file

@ -236,7 +236,7 @@ function repcal_getDayMonthNames($month, $day, $showDecadeDayName) {
$dayMonthString = $dayString . " " . $dayMonthString; $dayMonthString = $dayString . " " . $dayMonthString;
} }
} else { } else {
$dayMonthString = repcal_getComplementaryDay(); $dayMonthString = repcal_getComplementaryDay($day);
} }
return $dayMonthString; return $dayMonthString;
@ -291,6 +291,58 @@ function repcal_getComplementaryDayName($day) {
return $sanscullotidesArray[$day-1] ; return $sanscullotidesArray[$day-1] ;
} }
/* 3.1. Get names from the current month/day from a romme string
*/
function romme_getMonthName($romme_date_string) {
// Get month name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getMonthName($dateArray[0]);
}
function romme_getDayName($romme_date_string) {
// Get day name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getDayName($dateArray[1]);
}
function romme_getDayMonthNames($romme_date_string, $showDecadeDayName) {
// Get day name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getDayMonthNames($dateArray[0], $dateArray[1], $showDecadeDayName);
}
function romme_getComplementaryDay($romme_date_string) {
// Get the complementary day name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getComplementaryDay($dateArray[1]);
}
function romme_getEpiphany($romme_date_string) {
// Get day name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getEpiphany($dateArray[0], $dateArray[1]);
}
function romme_getComplementaryDayName($romme_date_string) {
// Get day name from the date string
$dateArray = romme_getArray($romme_date_string);
return repcal_getComplementaryDayName($dateArray[1]);
}
/* 4. Romme calendar string handling /* 4. Romme calendar string handling
These functions help the user to get a more beautifull romme string, These functions help the user to get a more beautifull romme string,