republicandate: simplify handling of sanscullotides number

Make the addition of the name part of the ordinal string system
This commit is contained in:
Kazhnuz 2018-11-07 16:30:58 +01:00
parent 5e660461ee
commit 97383d68f5
2 changed files with 13 additions and 9 deletions

View File

@ -35,9 +35,9 @@ $testJulianday = gregoriantojd($testMois, $testJour, $testAnnee);
<h2>Test des différentes fonctions</h2>
<p>
<strong>jdtoromme :</strong> <?php echo jdtoromme( $testJulianday );?> <br />
<strong>gregoriantoromme :</strong> <?php echo gregoriantoromme(date('n'), date('j'), date('Y'));?><br />
<strong>gregorian2FrenchDateString :</strong> <?php echo gregorian2FrenchDateString(date('n'), date('j'), date('Y'));?><br />
<strong>gregorian2FrenchDateStringShort :</strong> <?php echo gregorian2FrenchDateStringShort(date('n'), date('j'), date('Y'));?><br />
<strong>gregoriantoromme :</strong> <?php echo gregoriantoromme($testMois, date('j'), date('Y'));?><br />
<strong>gregorian2FrenchDateString :</strong> <?php echo gregorian2FrenchDateString($testMois, $testJour, $testAnnee);?><br />
<strong>gregorian2FrenchDateStringShort :</strong> <?php echo gregorian2FrenchDateStringShort($testMois, $testJour, $testAnnee);?><br />
</p>
</body>

View File

@ -135,7 +135,7 @@ function FrenchMonthNames($month)
"Sansculottide"); // The "13th" month is a special case for the sanscullotide,
// the leap days of the republican calendar.
if($month < count($monthArray)+1) {
return $monthArray[$month-1;
return $monthArray[$month-1];
}
}
@ -168,7 +168,7 @@ function FrenchSaintNames($month, $day) {
// Days names comes from Fabre d'Eglantine : https://en.wikipedia.org/wiki/French_Republican_calendar#Rural_Calendar
$epiphanyArray = array('Raisin','Safran','Châtaigne','Colchique','Cheval','Balsamine','Carotte','Amaranthe','Panais','Cuve','Pomme de terre','Immortelle','Potiron','Réséda','Âne','Belle de nuit','Citrouille','Sarrasin','Tournesol','Pressoir','Chanvre','Pêche','Navet','Amaryllis','Bœuf','Aubergine','Piment','Tomate','Orge','Tonneau', 'Pomme','Céleri','Poire','Betterave','Oie','Héliotrope','Figue','Scorsonère','Alisier','Charrue','Salsifis','Mâcre','Topinambour','Endive','Dindon','Chervis','Cresson','Dentelaire','Grenade','Herse','Bacchante','Azerole','Garance','Orange','Faisan','Pistache','Macjonc','Coing','Cormier','Rouleau', 'Raiponce','Turneps','Chicorée','Nèfle','Cochon','Mâche','Chou-fleur','Miel','Genièvre','Pioche','Cire','Raifort','Cèdre','Sapin','Chevreuil','Ajonc','Cyprès','Lierre','Sabine','Hoyau','Érable sucré','Bruyère','Roseau','Oseille','Grillon','Pignon','Liège','Truffe','Olive','Pelle', 'Tourbe','Houille','Bitume','Soufre','Chien','Lave','Terre végétale','Fumier','Salpêtre','Fléau','Granit','Argile','Ardoise','Grès','Lapin','Silex','Marne','Pierre à chaux','Marbre','Van','Pierre à plâtre','Sel','Fer','Cuivre','Chat','Étain','Plomb','Zinc','Mercure','Crible', 'Lauréole','Mousse','Fragon','Perce-neige','Taureau','Laurier tin','Amadouvier','Mézéréon','Peuplier','Coignée','Ellébore','Brocoli','Laurier','Avelinier','Vache','Buis','Lichen','If','Pulmonaire','Serpette','Thlaspi','Thimele','Chiendent','Trainasse','Lièvre','Guède','Noisetier','Cyclamen','Chélidoine','Traîneau', 'Tussilage','Cornouiller','Violier','Troène','Bouc','Asaret','Alaterne','Violette','Marceau','Bêche','Narcisse','Orme','Fumeterre','Vélar','Chèvre','Épinard','Doronic','Mouron','Cerfeuil','Cordeau','Mandragore','Persil','Cochléaria','Pâquerette','Thon','Pissenlit','Sylvie','Capillaire','Frêne','Plantoir', 'Primevère','Platane','Asperge','Tulipe','Poule','Bette','Bouleau','Jonquille','Aulne','Couvoir','Pervenche','Charme','Morille','Hêtre','Abeille','Laitue','Mélèze','Ciguë','Radis','Ruche','Gainier','Romaine','Marronnier','Roquette','Pigeon','Lilas (commun)','Anémone','Pensée','Myrtile','Greffoir', 'Rose','Chêne','Fougère','Aubépine','Rossignol','Ancolie','Muguet','Champignon','Hyacinthe','Râteau','Rhubarbe','Sainfoin','Bâton-d´or','Chamerops','Ver à soie','Consoude','Pimprenelle','Corbeille d´or','Arroche','Sarcloir','Statice','Fritillaire','Bourrache','Valériane','Carpe','Fusain','Civette','Buglosse','Sénevé','Houlette', 'Luzerne','Hémérocalle','Trèfle','Angélique','Canard','Mélisse','Fromental','Martagon','Serpolet','Faux','Fraise','Bétoine','Pois','Acacia','Caille','Œillet','Sureau','Pavot','Tilleul','Fourche','Barbeau','Camomille','Chèvrefeuille','Caille-lait','Tanche','Jasmin','Verveine','Thym','Pivoine','Chariot', 'Seigle','Avoine','Oignon','Véronique','Mulet','Romarin','Concombre','Échalote','Absinthe','Faucille','Coriandre','Artichaut','Girofle','Lavande','Chamois','Tabac','Groseille','Gesse','Cerise','Parc','Menthe','Cumin','Haricot','Orcanète','Pintade','Sauge','Ail','Vesce','Blé','Chalemie', 'Épeautre','Bouillon-blanc','Melon','Ivraie','Bélier','Prêle','Armoise','Carthame','Mûre','Arrosoir','Panic','Salicorne','Abricot','Basilic','Brebis','Guimauve','Lin','Amande','Gentiane','Écluse','Carline','Câprier','Lentille','Aunée','Loutre','Myrte','Colza','Lupin','Coton','Moulin', 'Prune','Millet','Lycoperdon','Escourgeon','Saumon','Tubéreuse','Sucrion','Apocyn','Réglisse','Échelle','Pastèque','Fenouil','Épine vinette','Noix','Truite','Citron','Cardère','Nerprun','Tagette','Hotte','Églantier','Noisette','Houblon','Sorgho','Écrevisse','Bigarade','Verge d´or','Maïs','Marron','Panier');
$absoluteDay = (($Month-1)*30)+$Day;
$absoluteDay = (($month-1)*30)+$day;
if($absoluteDay < count($epiphanyArray)+1)
return $epiphanyArray[$absoluteDay-1];
@ -197,8 +197,12 @@ function FrenchOrdinalNumber($Day) {
"Cinquième",
"Sixième");
if($Day < count($ordinalnumberArray)+1)
return $ordinalnumberArray[$Day-1] ;
if($Day < count($ordinalnumberArray) + 1) {
$ordinalName = $ordinalnumberArray[$Day-1];
$ordinalString = $ordinalName . " jour des Sanscullotides";
return $ordinalString;
}
}
function gregorian2FrenchDateString($m,$d,$y) {
@ -214,7 +218,7 @@ function gregorian2FrenchDateString($m,$d,$y) {
// If you are in a complentary day, show it the right way
if ($dateArray[0]==13) {
$dayMonthString = FrenchSansCullotidesNames($dateArray[1]) . ", ";
$saintString = FrenchOrdinalNumber($dateArray[1]) . " jour des " . $monthname;
$saintString = FrenchOrdinalNumber($dateArray[1]);
} else {
$dayMonthString = $dayname . ", " . $dateArray[1] . " " . $monthname . ", ";
$saintString = FrenchSaintNames($dateArray[0],$dateArray[1]);
@ -237,7 +241,7 @@ function gregorian2FrenchDateStringShort($m,$d,$y) {
// If you are in a complentary day, show it the right way
if ($dateArray[0]==13) {
$dayMonthString = FrenchSansCullotidesNames($dateArray[1]) . ", ";
$saintString = FrenchOrdinalNumber($dateArray[1]) . " jour des " . $monthname;
$saintString = FrenchOrdinalNumber($dateArray[1]);
} else {
$dayMonthString = $dateArray[1] . " " . $monthname . ", ";
$saintString = FrenchSaintNames($dateArray[0],$dateArray[1]);