romme-calendar: add a function to get easily the month+day name
This commit is contained in:
parent
1151e22610
commit
999f0b051d
1 changed files with 47 additions and 45 deletions
|
@ -162,34 +162,21 @@ function romme_getDayName($day)
|
||||||
return $dayArray[($day-1) % 10];
|
return $dayArray[($day-1) % 10];
|
||||||
}
|
}
|
||||||
|
|
||||||
function romme_getEpiphany($month, $day) {
|
function romme_getDayMonthNames($month, $day, $showDecadeDayName) {
|
||||||
// Convert a romme day and month number to the corresponding epiphany name.
|
|
||||||
|
|
||||||
// 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');
|
|
||||||
|
|
||||||
if ($month < 13) {
|
if ($month < 13) {
|
||||||
$absoluteDay = (($month-1)*30)+$day;
|
$dayString = romme_getDayName($day);
|
||||||
if($absoluteDay < count($epiphanyArray)+1) {
|
$monthString = romme_getMonthName($month);
|
||||||
return $epiphanyArray[$absoluteDay-1];
|
|
||||||
|
$dayMonthString = $day . " " . $monthString;
|
||||||
|
|
||||||
|
if ($showDecadeDayName == true) {
|
||||||
|
$dayMonthString = $dayString . " " . $dayMonthString;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
return romme_getComplementaryDayName($day);
|
$dayMonthString = romme_getComplementaryDay();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
function romme_getComplementaryDayName($Day) {
|
|
||||||
// Convert the sansculottide day number to its name.
|
|
||||||
|
|
||||||
// Complentary Day names: https://en.wikipedia.org/wiki/French_Republican_calendar#Complementary_days
|
return $dayMonthString;
|
||||||
$sanscullotidesArray = array("Jour de la vertu",
|
|
||||||
"Jour du génie",
|
|
||||||
"Jour du travail",
|
|
||||||
"Jour de l'opinion",
|
|
||||||
"Jour des récompenses",
|
|
||||||
"Jour de la révolution");
|
|
||||||
|
|
||||||
if($Day < count($sanscullotidesArray)+1)
|
|
||||||
return $sanscullotidesArray[$Day-1] ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function romme_getComplementaryDay($Day) {
|
function romme_getComplementaryDay($Day) {
|
||||||
|
@ -210,6 +197,37 @@ function romme_getComplementaryDay($Day) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function romme_getEpiphany($month, $day) {
|
||||||
|
// Convert a romme day and month number to the corresponding epiphany name.
|
||||||
|
|
||||||
|
// 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');
|
||||||
|
|
||||||
|
if ($month < 13) {
|
||||||
|
$absoluteDay = (($month-1)*30)+$day;
|
||||||
|
if($absoluteDay < count($epiphanyArray)+1) {
|
||||||
|
return $epiphanyArray[$absoluteDay-1];
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
return romme_getComplementaryDayName($day);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function romme_getComplementaryDayName($Day) {
|
||||||
|
// Convert the sansculottide day number to its name.
|
||||||
|
|
||||||
|
// Complentary Day names: https://en.wikipedia.org/wiki/French_Republican_calendar#Complementary_days
|
||||||
|
$sanscullotidesArray = array("Jour de la vertu",
|
||||||
|
"Jour du génie",
|
||||||
|
"Jour du travail",
|
||||||
|
"Jour de l'opinion",
|
||||||
|
"Jour des récompenses",
|
||||||
|
"Jour de la révolution");
|
||||||
|
|
||||||
|
if($Day < count($sanscullotidesArray)+1)
|
||||||
|
return $sanscullotidesArray[$Day-1] ;
|
||||||
|
}
|
||||||
|
|
||||||
function gregoriantoromme_completeString($m,$d,$y) {
|
function gregoriantoromme_completeString($m,$d,$y) {
|
||||||
// Convert a gregorian date to a complete romme date string
|
// Convert a gregorian date to a complete romme date string
|
||||||
|
|
||||||
|
@ -217,22 +235,14 @@ function gregoriantoromme_completeString($m,$d,$y) {
|
||||||
$dateArray = gregoriantoromme_getArray($m,$d,$y);
|
$dateArray = gregoriantoromme_getArray($m,$d,$y);
|
||||||
|
|
||||||
// Get the month and day names
|
// Get the month and day names
|
||||||
$monthname = romme_getMonthName($dateArray[0]) ;
|
$dayMonthString = romme_getDayMonthNames($dateArray[0], $dateArray[1], true);
|
||||||
$dayname = romme_getDayName($dateArray[1]);
|
|
||||||
|
|
||||||
// If you are in a complentary day, show it the right way
|
|
||||||
if ($dateArray[0]==13) {
|
|
||||||
$dayMonthString = romme_getComplementaryDay($dateArray[1]) . ", ";
|
|
||||||
} else {
|
|
||||||
$dayMonthString = $dayname . ", " . $dateArray[1] . " " . $monthname . ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
$saintString = romme_getComplementaryDayName($dateArray[0],$dateArray[1]);
|
$saintString = romme_getComplementaryDayName($dateArray[0],$dateArray[1]);
|
||||||
|
|
||||||
// Create the string for the year
|
// Create the string for the year
|
||||||
$yearString = "an " . $dateArray[2];
|
$yearString = "an " . $dateArray[2];
|
||||||
|
|
||||||
return $dayMonthString . $yearString . "<br /><em>" . $saintString . "</em>";
|
return $dayMonthString . ", " . $yearString . "<br /><em>" . $saintString . "</em>";
|
||||||
}
|
}
|
||||||
|
|
||||||
function gregoriantoromme_simplerString($m,$d,$y) {
|
function gregoriantoromme_simplerString($m,$d,$y) {
|
||||||
|
@ -240,19 +250,11 @@ function gregoriantoromme_simplerString($m,$d,$y) {
|
||||||
$dateArray = gregoriantoromme_getArray($m,$d,$y);
|
$dateArray = gregoriantoromme_getArray($m,$d,$y);
|
||||||
|
|
||||||
// Get the month and day names
|
// Get the month and day names
|
||||||
$monthname = romme_getMonthName($dateArray[0]);
|
$dayMonthString = romme_getDayMonthNames($dateArray[0], $dateArray[1], false);
|
||||||
$dayname = romme_getDayName($dateArray[1]);
|
|
||||||
|
|
||||||
// If you are in a complentary day, show it the right way
|
|
||||||
if ($dateArray[0]==13) {
|
|
||||||
$dayMonthString = romme_getComplementaryDay($dateArray[1]) . ", ";
|
|
||||||
} else {
|
|
||||||
$dayMonthString = $dateArray[1] . " " . $monthname . ", ";
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create the string for the year
|
// Create the string for the year
|
||||||
$yearString = "an " . $dateArray[2];
|
$yearString = "an " . $dateArray[2];
|
||||||
|
|
||||||
return $dayMonthString . $yearString;
|
return $dayMonthString . ", " . $yearString;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in a new issue