From 97383d68f536f7c56b9d3284cf7d162c878ffc14 Mon Sep 17 00:00:00 2001 From: Kazhnuz Date: Wed, 7 Nov 2018 16:30:58 +0100 Subject: [PATCH] republicandate: simplify handling of sanscullotides number Make the addition of the name part of the ordinal string system --- exemple.php | 6 +++--- republicandate.php | 16 ++++++++++------ 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/exemple.php b/exemple.php index ef7d39e..4d05156 100644 --- a/exemple.php +++ b/exemple.php @@ -35,9 +35,9 @@ $testJulianday = gregoriantojd($testMois, $testJour, $testAnnee);

Test des différentes fonctions

jdtoromme :
- gregoriantoromme :
- gregorian2FrenchDateString :
- gregorian2FrenchDateStringShort :
+ gregoriantoromme :
+ gregorian2FrenchDateString :
+ gregorian2FrenchDateStringShort :

diff --git a/republicandate.php b/republicandate.php index 6b0797c..95ca7fa 100644 --- a/republicandate.php +++ b/republicandate.php @@ -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]);