romme-calendar: add new function to get a better string from romme date string

This commit is contained in:
Kazhnuz 2018-11-09 10:38:02 +01:00
parent b2e49ab064
commit 14bd6481d8
2 changed files with 44 additions and 1 deletions

View file

@ -56,8 +56,11 @@ $testJulianday = gregoriantojd($testMois, $testJour, $testAnnee);
<strong>romme_getComplementaryDayName :</strong> <?php echo romme_getComplementaryDayName( jdtoromme( $testJulianday ) );?> <br />
</p>
<h2>Test des différentes fonctions</h2>
<h2>Getting an automated string</h2>
<p>
<strong>romme_completeString :</strong> <?php echo romme_completeString( jdtoromme( $testJulianday ) );?> <br />
<strong>romme_simplerString :</strong> <?php echo romme_simplerString( jdtoromme( $testJulianday ) );?> <br />
<strong>gregorian2FrenchDateString :</strong> <?php echo gregoriantoromme_completeString($testMois, $testJour, $testAnnee);?><br />
<strong>gregorian2FrenchDateStringShort :</strong> <?php echo gregoriantoromme_simplerString($testMois, $testJour, $testAnnee);?><br />

View file

@ -348,6 +348,46 @@ function romme_getComplementaryDayName($romme_date_string) {
These functions help the user to get a more beautifull romme string,
usable directly in their pages.
*/
/* 4.1. Converting the romme string to a better string
*/
function romme_completeString($romme_date_string) {
// Convert a romme date string to a complete romme date string
// Start by getting the romme array
$dateArray = romme_getArray($romme_date_string);
// Get the month and day names
$dayMonthString = repcal_getDayMonthNames($dateArray[0], $dateArray[1], true);
$saintString = repcal_getComplementaryDayName($dateArray[0], $dateArray[1]);
// Create the string for the year
$yearString = "an " . $dateArray[2];
return $dayMonthString . ", " . $yearString . "<br /><em>" . $saintString . "</em>";
}
function romme_simplerString($romme_date_string) {
// Convert a romme date string to a shorter romme date string
// Start by getting the romme array
$dateArray = romme_getArray($romme_date_string);
// Get the month and day names
$dayMonthString = repcal_getDayMonthNames($dateArray[0], $dateArray[1], false);
// Create the string for the year
$yearString = "an " . $dateArray[2];
return $dayMonthString . ", " . $yearString;
}
/* 4.2. Getting it from the gregorian date
*/
function gregoriantoromme_completeString($m,$d,$y) {
// Convert a gregorian date to a complete romme date string