RevCal.php

Petites libraires de calendriers basés sur celui révolutionnaire. Accéder au code.

RommeCalendar

RommeCalendar est une librairie PHP permettant d'afficher des dates dans le calendrier révolutionnaire notamment après la suppression du calendrier révolutionnaire par Napoléon. Elle est constituée principalement d'une classe, et de quelques fonctions utilitaires afin de pouvoir parse la date.

Utiliser la librairie

La librairie est constituée d'un fichier unique revcal-romme.php, qui peut ensuite être require pour pouvoir être utilisé.

include(revcal-romme.php);
$calendar = new RommeCalendar($year, $month, $day); // Utiliser les années/mois/jours

Afficher la date "simple" (jour + mois + année)

include(revcal-romme.php);
echo romme_today($showDecadeDayName);

$showDecadeDayName détermine si vous affichez le nom du jour de la décade

Affiche la date "complete" (avec l'epiphanie du jour)

include(revcal-romme.php);
echo romme_today_complete();

Pour déclarer une date, vous avez plusieurs manière suivant votre besoins. Voici quelques exemples de déclarations pour pouvoir utiliser la classe :

RommeCalendar::today(); // Créer une date à la date du jour
RommeCalendar::fromJulianDay($juliandaycount); // Permet de créer une date à partir du jour julien (surtout utilisé en interne)
RommeCalendar::fromString($str); // Parse des chaines de caractère genre 234-11-02
RommeCalendar::fromGregorian($y, $m, $d) // Créer une date révolutionnaire à partir d'une date Gregorienne

Résultat de RommeCalendar::today() : 234-12-20

Convertir une date

Entrez une date grégorienne pour ensuite avoir la version révolutionnaire de la date :)

Récupérer le mois/jours/années/etc

RommeCalendar->__toString(): 234-12-20
RommeCalendar->getDay(): 20
RommeCalendar->getMonth(): 12
RommeCalendar->getYear(): 234
RommeCalendar->getYearDay(): 350
RommeCalendar->getWeek(): 35
RommeCalendar->isLeapYear(): non

Formatter une date

$romeCalendar->format($format); // Formatte une date
$romeCalendar->formatWithComplementaryFormat($format, $complementaryFormat); // Format avec deux format
// Un jour les jours normaux, et l'autre pour les jours complémentaires;

Vous pouvez ensuite utilisez les caractères suivants.

Character Description Exemple
\\ Permet d'échapper toutes les lettres jusqu'au prochain caractère spécial
Days -- --
D A textual representation of a day, three letters Pri-Dec
j Day of the month without leading zeros 1-30
l (lowercase 'L') A full textual representation of the day of the "week" Primidi-Decadi
N ISO-8601-like numeric representation of the day of the "week" 1(primidi)-10(Decadi)
w Numeric representation of the day of the week 0(primidi)-9(decadi)
z The day of the year (starting from 0) 0 through 365
J The ephemeride Jour de la Revolution
c The number of the complementary day Premier jour complémentaire
Week -- --
W Revolutionar "week", which have 10 days 1-36
Month -- --
F A full textual representation of a month, such as January or March Vendemiaire to Jour Complémentaire
m Numeric representation of a month, with leading zeros 01 to 13 (Jours complémentaires)
M A short textual representation of a month, three letters Ven to Com
n Numeric representation of a month, without leading zeros 1 to 13
t Number of days in the given month 30
Year -- --
L Whether it's a leap year 1 if it is a leap year, 0 otherwise.
o Same as Y (no difference between Y in week) See Y
Y A full numeric representation of a year, 3 or 4 digits 224
y A two digit representation of a year 23

Format prédéfini :

A noter que les formats complémentaire ne marchent pas bien en dehors des jours complémentaires, étant fait spécifiquement pour eux.

RommeCalendar::FORMAT_JOUR_MOIS ("j F"): 20 Fructidor
RommeCalendar::FORMAT_SIMPLE ("l j F"): Décadi 20 Fructidor
RommeCalendar::FORMAT_COMPLET ("l j F, \an Y"): Décadi 20 Fructidor, an 234
RommeCalendar::FORMAT_COMPLEMENTAIRE ("J"): Hotte
RommeCalendar::FORMAT_COMPLEMENTAIRE_COMPLET ("J (c), \an Y"): Hotte (), an 234

Crédits et inspiration