view release on metacpan or search on metacpan
Revision history for Perl extension Date::Convert::French_Rev.
0.09 Primidi 1st Vendémiaire CCXXIX, jour du raisin, new year's day (Tuesday 22 September 2020)
- fix a few typos in the feasts names (thank you Gérald)
- add a few entries in the "SEE ALSO" chapter (thank you Gérald)
- tidy up the documentation, for example replacing http:// by https:// whenever possible
- start a deprecation process for the %L strftime specifier
- check the scripts in the eg subdirectory
0.08 Tridi 23 Thermidor CCXXIII, jour de la lentille (Monday 2015-08-10,
which, according to the Gregorian calendar, is the 223rd anniversary
of the storming of the Tuileries palace)
- fix prerequisite: Date::Convert 0.16 is fine, 0.14 is not.
Actually, RT ticket 90470 was prematurely and erroneously declared
as "fixed".
- improve the documentation of method "change_to".
- add more tests
0.07 Décadi 10 Thermidor CCXXIII, jour de l'arrosoir (Tuesday 2015-07-28, also
the 221st anniversary of Robespierre's death)
- fix prerequisite: Date::Convert 0.16 is fine, 0.14 is not (RT ticket 90470)
- test file to check the parameter checks (mistakenly not included in 0.06)
- a few documentation fixes
- fix the mojibake bug (similar to RT ticket 100311 for DT::C::FR)
- add an alternate API to convert from French Revolutionary to other calendar
0.06 Octidi 18 Brumaire CCXXII, jour de la dentelaire (Friday 2013-11-08, also
the 214th anniversary of Bonaparte's coup agains the Directorate)
- kwalitee issues: license, style, META.{yml,json}
- use UTF-8 instead of ISO-8859-1, use spaces instead of tabs
- more tests, more modern tests
0.05 Nonidi 9 Floréal CCXI, jour de la jacinthe (Monday 2003-04-28)
- last version compatible with Date::Convert, next one will
be in the DateTime::Calendar namespace, compatible with DateTime.pm
{
"abstract" : "Date conversions using the French Revolutionary calendar",
"author" : [
"Jean Forget <JFORGET@cpan.org>"
],
"dynamic_config" : 1,
"generated_by" : "ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
---
abstract: 'Date conversions using the French Revolutionary calendar'
author:
- 'Jean Forget <JFORGET@cpan.org>'
build_requires:
ExtUtils::MakeMaker: '0'
Test::More: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 1
generated_by: 'ExtUtils::MakeMaker version 7.1002, CPAN::Meta::Converter version 2.150005'
license: perl
Makefile.PL view on Meta::CPAN
# Inc., <https://www.fsf.org/>.
#
use ExtUtils::MakeMaker;
WriteMakefile(
'NAME' => 'Date::Convert::French_Rev'
, 'VERSION_FROM' => 'lib/Date/Convert/French_Rev.pm'
, 'PREREQ_PM' => { Roman => 0
, Date::Convert => '0.16'
}
, 'ABSTRACT' => 'Date conversions using the French Revolutionary calendar'
, 'AUTHOR' => 'Jean Forget <JFORGET@cpan.org>'
, 'LICENSE' => 'perl'
, 'MIN_PERL_VERSION' => '5.8.8'
, 'BUILD_REQUIRES' => { 'Test::More' => '0', # should be 'TEST_REQUIRES', except that ExtUtils::MakeMaker 6.5705 does not accept it
'ExtUtils::MakeMaker' => '6.57_02',
},
, META_MERGE => {
'meta-spec' => { version => 2 },
'prereqs' => {
'build' => {
Date::Convert::French_Rev - Jean Forget <JFORGET@cpan.org>
Date conversion using the French Revolutionary calendar.
PRESENTATION
This module is a add-on to Mordechai Abzug's Date::Convert
module. Since his module is pre-alpha, mine is, too. Another
consequence is that this module allows you to convert from or to any
calendar implemented in Date::Convert. These calendars are currently
Gregorian, Julian, Hebrew and absolute (which is Julian Day Number,
with midnight-to-midnight days instead of noon-to-noon).
This module allows you to pretty-print French Revolutionary dates.
You can use this module even if you do not have Perl on your computer.
See the alternate install procedure below.
WHY A NEW VERSION AFTER TEN YEARS?
This directory contains a few examples of program using the French
Revolutionary calendar module. There are:
today -- the name says it all. Typically called from your .profile.
prt_cal -- to generate a HTML file, containing the calendar for a given
French Revolutionary year.
g2r_table -- to generate a HTML file, which will give a few tables to
convert a Gredorian date into a French Revolutionary date. The
instructions for use are included.
r2g_table -- the opposite of g2r_table.
labels_* -- auxiliary files, used by prt_cal, g2r_table and r2g_table,
for language-dependant values, especially the instructions for use.
eg/g2r_table view on Meta::CPAN
$_ = eval "qq($labels{usage2})";
print;
}
__END__
=encoding utf8
=head1 NAME
g2r_table - Print a few charts which can be used to convert a date from the Gregorian calendar to the French Revolutionary calendar.
=head1 SYNOPSIS
g2r_table [--columns=I<number>] [--example=I<date>] [--lang=I<language>] [--table-workaround]
=head1 DESCRIPTION
This program prints five tables, plus a small text showing how to use
these tables. The output uses UTF-8 encoding and HTML format. When
printed from a table-aware web browser, these tables allow a
computer-less user to convert dates from the Gregorian calendar to the
French Revolutionary calendar.
=head1 OPTIONS
=over 4
=item columns
The number of columns in the first table. This number must be a
multiple of 4 (because of the 4-year quasi-cycle for leap days) plus
one (for the first line, giving year intervals). So you can choose 5,
eg/labels_en view on Meta::CPAN
# Inc., <https://www.fsf.org/>.
#
#
# The labels hash, under an assumed name
#
use utf8;
use strict;
use warnings;
my %labels =
( calendar => 'Calendar'
, month3 => [ qw(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec) ]
, week1 => [ qw(M T W T F S S) ]
, add_days => 'Additional Days'
, month => [ qw(January February March April May June July August September
October November December) ]
, title1 => "Year to letter"
, title2 => { b => "Beginning of Year", m => "Middle of Year", e => "End of Year" }
, title3 => "Month names and day names"
, year_ttl => "Year"
, titleg2r => "Converting dates from Gregorian to French Revolutionary"
eg/labels_fr view on Meta::CPAN
# Inc., <https://www.fsf.org/>.
#
#
# Le hachage des libellés
#
use utf8;
use strict;
use warnings;
my %labels =
( calendar => 'Calendrier'
, month3 => [ qw(jan fév mars avr mai juin juil août sep oct nov déc) ]
, week1 => [ qw(L M M J V S D) ]
, add_days => 'Jours complémentaires'
, month => [ qw(Janvier Février Mars Avril Mai Juin Juillet Août Septembre
Octobre Novembre Décembre) ]
, title1 => "Lettres pour une année"
, title2 => { b => "Début d'année", m => "Milieu d'année", e => "Fin d'année" }
, title3 => "Nom des mois et des jours"
, year_ttl => "Année"
, titleg2r => "Conversion de dates du calendrier grégorien vers le calendrier républicain"
#!/usr/bin/perl
# -*- encoding: utf-8; indent-tabs-mode: nil -*-
#
# Example of Date::Convert::French_Rev script to print a French Revolutionary calendar
# Copyright (C) 2001-2003, 2013, 2015, 2020 Jean Forget
#
# See the license in the embedded documentation below.
#
use utf8;
use strict;
use warnings;
use FindBin;
use Getopt::Long;
use Date::Convert::French_Rev;
sub prt_cal {
my $year = $_[0]; # French revolutionary year
my $year_1 = $year + 1791; # first corresponding Gregorian year
my $year_2 = $year + 1792; # second corresponding Gregorian year
# HTML header
print <<"EOT";
<html>
<head>
<title>$labels{calendar}</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>
<body>
EOT
print qq(<p align='center'><img src='$pict'>\n) if $pict;
# Column headers for the first six months
print <<"EOT";
<h2 align='center'>@{[ Roman $year ]}</h2>
<h3 align='center'>$year_1-$year_2</h3>
<table border width='90%'>
$wd = $labels{week1}[$day->absol() % 7];
sprintf "%2d (%s %2d)", $rd, $wd, $gd;
}
__END__
=encoding utf8
=head1 NAME
prt_cal -- print a French Revolutionary calendar
=head1 SYNOPSIS
prt_cal [--lang=I<language>] [--kitten=I<file>] year
=head1 DESCRIPTION
This program prints a calendar, using the French Revolutionary
calendar. It is not limited to the historical period when this
calendar was in use, you can ask for any year after its beginning. For
example, you can print the calendar for the year 211, which
corresponds to 2002-2003 in the Gregorian calendar. The output is in
HTML, and contains brief indications for which Gregorian date
corresponds to each French Revolutionary date.
=head1 OPTIONS
=over 4
=item language
Some values are language dependant: Gregorian weekday initials,
English (default)
=item fr
French
=back
=item kitten
In France, traditionnally, the postal service sells calendars for the
next year during November / December. These calendars usually have the
picture of one or more kittens in a basket, or a mountainous
landscape. So, you can do the same with this program, by specifying a
JPEG or GIF URL, which contains the photo of kittens or a picture of
mountains. Don't even think of using anything else, especially
pictures involving scantily clad ladies.
You can try
https://images.google.com/images?hl=en&lr=&ie=ISO-8859-1&output=search&q=kitten+basket
https://images.google.com/images?hl=en&lr=&ie=ISO-8859-1&output=search&q=mountains
but do not even think about
https://images.google.com/images?q=Delacroix+libert%C3%A9+guidant+peuple&hl=en&lr=&ie=UTF-8&output=search
=back
=head1 PARAMETERS
There is a single parameter, the year, according to the French
Revolutionary calendar. This parameter is numeric (Roman number not
permitted).
=head1 KNOWN BUGS
If given several years, the program prints all the requested calendars
on standard output as a single stream. There are HTML delimiters for
each, but they are concatenated.
=head1 AUTHOR
Jean Forget <JFORGET@cpan.org>
=head1 LICENSE
Copyright (c) 2001, 2002, 2003, 2013, 2015, 2020 Jean Forget. All
eg/r2g_table view on Meta::CPAN
$_ = eval "qq($labels{usage4})";
print;
}
__END__
=encoding utf8
=head1 NAME
r2g_table - Print a few charts which can be used to convert a date from the French Revolutionary calendar to the Gregorian calendar.
=head1 SYNOPSIS
r2g_table [--columns=I<nb>] [--example=I<date>] [--lang=I<language>] [--table-workaround]
=head1 DESCRIPTION
This program prints three tables, plus a small text showing how to use
these tables. The output uses UTF-8 encoding and HTML format. When
printed from a table-aware web browser, these tables allow a
computer-less user to convert dates from the French Revolutionary
calendar to the Gregorian calendar.
=head1 OPTIONS
=over 4
=item columns
The number of columns in the the first table. This must be a multiple
of 4, plus 1. With 5, you get a narrow table with many lines, while
with 13 or even 17, you get a wide table with fewer lines.
Date::Convert::French_Rev->convert($day);
print $day->date_string("French Revolutionary: %A %d %B %EY, %Ej%n");
__END__
=encoding utf8
=head1 NAME
today - Print the current date in various calendars.
=head1 SYNOPSIS
today
=head1 DESCRIPTION
This program prints the current date in Gregorian, Julian, Hebrew and
French Revolutionary calendar.
=head1 OPTIONS
None.
=head1 AUTHOR
Jean Forget <JFORGET@cpan.org>
=head1 LICENSE
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
# -*- encoding: utf-8; indent-tabs-mode: nil -*-
#
# Perl Date::Convert extension to convert dates from/to the French Revolutionary calendar
# Copyright (C) 2001-2003, 2013, 2015, 2020 Jean Forget
#
# See the license in the embedded documentation below.
#
package Date::Convert::French_Rev;
use utf8;
use strict;
use warnings;
use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
require Exporter;
@ISA = qw(Date::Convert Exporter);
# Do not export methods, therefore export nothing
@EXPORT = qw(
);
$VERSION = '0.09';
use constant REV_BEGINNING => 2375840; # 1 Vendémiaire I in the Revolutionary calendar
my @MONTHS_SHORT = qw ( Vnd Bru Fri Niv Plu Vnt Ger Flo Pra Mes The Fru S-C);
my @MONTHS = qw(Vendémiaire Brumaire Frimaire
Nivôse Pluviôse Ventôse
Germinal Floréal Prairial
Messidor Thermidor Fructidor);
push @MONTHS, "jour complémentaire"; # Incompatible with qw(), because of embedded space
# The day numer 10 is counterintuitively placed in the 0-th element
# because the modulus operator and the Perl arrays are 0-based.
# It works. Do not report a bug.
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
my @PREFIXES = ('jour du ', 'jour de la ', "jour de l'", 'jour des ');
use constant NORMAL_YEAR => 365;
use constant LEAP_YEAR => 366;
use constant FOUR_YEARS => 4 * NORMAL_YEAR + 1; # one leap year every four years
use constant CENTURY => 25 * FOUR_YEARS - 1; # centuries aren't leap years...
use constant FOUR_CENTURIES => 4 * CENTURY + 1; # ...except every four centuries that are.
use constant FOUR_MILLENIA => 10 * FOUR_CENTURIES - 1; # ...except every four millenia that are not.
# number of days between the start of the revolutionary calendar, and the
# beginning of year n - 1
my @YEARS_BEGINS= (0, 365, 730, 1096, 1461, 1826, 2191, 2557, 2922, 3287, 3652,
4018, 4383, 4748, 5113, 5479, 5844);
# This method shoudl be in the master class, but for the moment, it is only available here
sub change_to {
croak "Need to specify the new calendar"
if @_ <= 1;
my ($self, $new_cal) = @_;
$new_cal->convert($self);
}
sub initialize {
my $self = shift;
my ($year, $month, $day) = @_;
unless (defined($year) and defined($month) and defined($day))
{ croak "Date::Convert::French_Rev::initialize needs more args" }
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
Return just the day number element of date.
=item is_leap
Boolean.
=item convert
Change the date to a new format. The invocant is the class name of the
destination calendar, the parameter is the C<Date::Convert::>I<whatever>
object to convert.
=item change_to
Change the date to a new format. The invocant is the
C<Date::Convert::>I<whatever> object to convert, the parameter is the
class name of the destination calendar. For the moment, this method is
available only for C<Date::Convert::French_Rev> invocant objects.
=item date_string
Return the date in a pretty format. You can give an string parameter
to adjust the date format to your preferences.
=back
The format parameter to C<date_string> is a string consisting of any
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
=over 4
=item %y
2-digit year - 00 to 99
=item %Y, %G
year - 0001 to 9999. There is no difference between these three
variants. This is because in the Revolutionary calendar, the beginning
of a year is always aligned with the beginning of a décade, while in
the Gregorian calendar, the beginning of a year is usually not aligned
with the beginning of a week.
=item %L
This is a third specifier for the year. The problem is that I have
forgotten why I have implemented this specifier. There are plenty of
strftime-like libraries visible on the Internet, none of them has a
C<%L> specifier for the year. So where does it come from?
I will deprecate this speficier in the next module releases. For the
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
day of month - " 1" to "30". The number is formatted as a 2-char
string, with a leading space if necessary.
=item %A
day of décade - "Primidi" to "Décadi". A variable length string.
=item %a
abbreviated day of décade - "Pri" to "Déc". A 3-char string. Beware:
do not confuse Sep, Oct and Déc with Gregorian calendar months
=item %w
day of décade - " 1" to "10" (" 1" for Primidi, " 2" for Duodi,
etc). The number is formatted as a 2-char string, with a leading space
if necessary.
=item %j
day of the year - "001" to "366". A 3-char string, with leading zeroes
if necessary.
=item %Ej
full name of the day of the year. Instead of assigning a saint to each
day, the creators of the calendar decided to assign a plant, an animal
or a tool. A variable-length string.
=item %EJ
same as %Ej, but significant words are capitalized.
=item %*
same as %Ej.
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
=over 4
=item year %s out of range
The module does not deal with year prior to the epoch. The year must
be "1" or greater.
=item month %s out of range
The French Revolutionary calendar has 12 months, plus 5 or 6
additional days that do not belong to a month. So the month number
must be in the 1-12 range for normal days, or 13 for additional days
=item standard day number %s out of range
The day number for any normal month is in the 1-30 range.
=item additional day %s out of range
The day number for the end-of-year additional days is a number in the
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
the build process, not for the regular use of
C<Date::Convert::French_Rev>.
You should not use the C<%L> strftime specifier. For the moment it
prints the year, but in some next release, about in Vendémiaire 231
(that is, September 2022) it will produce a warning. And after another
two years it will be removed.
=head1 HISTORICAL NOTES
The Revolutionary calendar was in use in France from 24 November 1793
(4 Frimaire II) to 31 December 1805 (10 Nivôse XIV). An attempt to use
the decimal rule (the basis of the metric system) to the
calendar. Therefore, the week disappeared, replaced by the décade (10
days, totally different from the English word "decade", 10 years). In
addition, all months have exactly 3 decades, no more, no less.
At first, the year was beginning on the equinox of autumn, for two
reasons. First, the republic had been established on 22 September
1792, which happened to be the equinox, and second, the equinox was
the symbol of equality, the day and the night lasting exactly 12 hours
each. It was therefore in tune with the republic's motto "Liberty,
Equality, Fraternity". But it was not practical, so Romme proposed a
leap year rule similar to the Gregorian calendar rule.
In his book I<The French Revolution>, the 19th century writer Thomas
Carlyle proposes these translations for the month names:
Vendémiaire -> Vintagearious
Brumaire -> Fogarious
Frimaire -> Frostarious
Nivôse -> Snowous
Pluviôse -> Rainous
Ventôse -> Windous
lib/Date/Convert/French_Rev.pm view on Meta::CPAN
L<Date::Converter>
=head2 Other Software
date(1)
CALENDRICA 4.0 -- Common Lisp, which can be download in the "Resources" section of
L<https://www.cambridge.org/us/academic/subjects/computer-science/computing-general-interest/calendrical-calculations-ultimate-edition-4th-edition?format=PB&isbn=9781107683167>
F<calendar/cal-french.el> in emacs-21.2 or later or xemacs 21.1.8,
forked in L<https://github.com/jforget/emacs-lisp-cal-french>
C<Date::Calendar::FrenchRevolutionary> for Raku at L<https://modules.raku.org/dist/Date::Calendar::FrenchRevolutionary:cpan:JFORGET>
or L<https://github.com/jforget/raku-Date-Calendar-FrenchRevolutionary>
L<https://www.gnu.org/software/apl/Bits_and_Pieces/calfr.apl.html> or L<https://github.com/jforget/apl-calendar-french>
L<https://www.hpcalc.org/details/7309> or L<https://github.com/jforget/hp48-hp50-French-Revolutionary-calendar>
L<https://github.com/jforget/hp41-calfr>
French Calendar for Android at
L<https://f-droid.org/packages/ca.rmen.android.frenchcalendar/>
or L<https://github.com/caarmen/FRCAndroidWidget>
and L<https://github.com/caarmen/french-revolutionary-calendar>
Thermidor for Android at L<https://github.com/jhbadger/Thermidor-Android>
A Ruby program at L<https://github.com/jhbadger/FrenchRevCal-ruby>
=head2 books
Quid 2001, M and D Frémy, publ. Robert Laffont
Agenda Républicain 197 (1988/89), publ. Syros Alternatives
Any French schoolbook about the French Revolution
The French Revolution, Thomas Carlyle, Oxford University Press
=head2 Internet
L<http://www.faqs.org/faqs/calendars/faq/part3/>
L<https://h2g2.com/approved_entry/A2903636>
L<https://www.allhotelscalifornia.com/kokogiakcom/frc/default.asp>
L<https://en.wikipedia.org/wiki/French_Republican_Calendar>
L<https://fr.wikipedia.org/wiki/Calendrier_républicain>
L<http://prairial.free.fr/index.php?lien=cal_sommaireFR>