DateTime-Calendar-FrenchRevolutionary

 view release on metacpan or  search on metacpan

eg/g2r_table  view on Meta::CPAN

      unless ($old_line =~ m{$intersection} && $new_line =~ m{$intersection}) {
        $current_start = $year;
        $line_for_interval{$year} = $new_line;
      }
      $line_for_interval{$current_start} |= $new_line;
      $end_of_interval{$current_start} = $year;
  }
}

#
# Compute the formulas for a sample year and for a month.
# 1st January 1796 is 11 Nivôse IV, and 31 January 1796 is 11 Pluviôse IV.
# Therefore, for January 1796, we have two formulas : "+10 Niv" and "-20 Plu".
# Since all French Revolutionary months have 30 days, only one computation is necessary.
# Exception: the additional days are grouped in a notional 13th month, which lasts
# either 5 or 6 days. In this case, we have 3 formulas for September, at the cost of 2 conversions.
#
sub formulas {
  my ($year, $month) = @_;
  my @formulas = ();
  my @month = qw(Niv Plu Vnt Ger Flo Pra Mes The Fru S-C Vnd Bru Fri Niv);
  #my $date = new Date::Convert::Gregorian $year, $month, 1;
  #convert Date::Convert::FrenchRevolutionary $date;
  my $dg = DateTime->new(year => $year, month => $month);
  my $dr = DateTime::Calendar::FrenchRevolutionary->from_object(object => $dg);
  my $offset = $dr->day() - 1;
  if ($month <= 9) # Have to split in two, because of the additional days within @month
    {
      push @formulas, "+$offset $month[$month - 1]";
      $offset = 30 - $offset;
      push @formulas, "-$offset $month[$month]";
    }
  else
    {
      push @formulas, "+$offset $month[$month]";
      $offset = 30 - $offset;
      push @formulas, "-$offset $month[$month + 1]";
    }
  if ($month == 9)
    {
      #$date  = new Date::Convert::FrenchRevolutionary $year - 1791, 1, 1;
      #convert Date::Convert::Gregorian $date;
      $dr = DateTime::Calendar::FrenchRevolutionary->new(year => $year - 1791);
      $dg = DateTime->from_object(object => $dr);
      $offset = $dg->day() - 1;
      push @formulas, "-$offset Vnd";
    }

  @formulas;
}

sub html_0 {
  my ($title) = @_;
  print <<"EOF";
<html>
<head>
<title>$title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

eg/g2r_table  view on Meta::CPAN

  my ($part)  = @_;
  my @days    = sort { $a <=> $b } grep { $_ != 1 } keys %{$letter_of_partday{$part}};
  my $colspan = @days + 1;
  print "<p><table border><tr><th align='center' colspan='$colspan'>$labels{title2}{$part}</th></tr>\n";
  html_2header($part eq 'e' ? 1791 : 1792, $part);
  # the part of September in the end of the year
  if ($part eq 'e') {
    print "<tr align='center'><td>$labels{month}[8]</td>";
    foreach (@days) {
      my $year = $year_of_partday{$part}{$_};
      my @formulas = formulas($year, 9);
      print "<td>$formulas[2]</td>\n";
    }
    print "</tr>\n";
  }
  # The regular months of the part of the year
  my @month_list = $part eq 'b' ? (1..2) : $part eq 'm' ? (3..9) : (10..12);
  foreach my $month (@month_list) {
    print "<tr align='center'><td>$labels{month}[$month - 1]</td>";
    foreach (@days) {
      my $year = $year_of_partday{$part}{$_};
      my @formulas = formulas($year, $month);
      print "<td>$formulas[0]<br>$formulas[1]</td>\n";
    }
    print "</tr>\n";
  }

  print "</table>\n";
}

sub html_2header {
  my ($offset, $part) = @_;
  my @letters = sort grep { $_ ne ' ' } values %{$letter_of_partday{$part}};

eg/g2r_table  view on Meta::CPAN

  # First example
  my $gr_date  = &{$labels{format}}($y, $m, $d, $lang);
  #my $date = new Date::Convert::Gregorian $y, $m, $d;
  #convert Date::Convert::FrenchRevolutionary $date;
  my $date = DateTime::Calendar::FrenchRevolutionary->from_object(object => DateTime->new(year => $y, month => $m, day => $d));
  my $y2       = sprintf "%02d", $y % 100;
  my $part     = $m <= 2 ? 'b' : $m < 9 ? 'm' : 'e';
  my $offset   = $part eq 'e' ? 1791 : 1792;
  my $letter   = letter_of_yearpart($y, $part);
  my $word     = word_for_year($y);
  my @formulas = formulas($y, $m);
  my $limit    = $1 if $formulas[1] =~ /(\d+)/;
  my $formula  = $formulas[$d <= $limit ? 0 : 1];
  my $ryear    = $date->year();
  my $begint; # Beginning of the interval
  foreach (sort { $a <=> $b } keys %end_of_interval)
    {
      last if $y < $_;
      $begint = $_;
    }
  my $abridged  = $date->strftime("%e %b");
  my $rev_date  = $date->strftime("%A %e %B %EY");
  $_ = eval "qq($labels{usage1})";
  print;
  print "\n";

  # Second example: September
  # $m = 9;
  $gr_date  = &{$labels{format}}($y, 9, $d, $lang);
  #$date = new Date::Convert::Gregorian $y, 9, $d;
  #convert Date::Convert::FrenchRevolutionary $date;
  $date = DateTime::Calendar::FrenchRevolutionary->from_object(object => DateTime->new(year => $y, month => 9, day => $d));
  @formulas   = formulas($y, 9);
  my $mletter = letter_of_yearpart($y, 'm');
  my $eletter = letter_of_yearpart($y, 'e');
  $abridged   = $date->strftime("%e %b %Y");
  $rev_date   = $date->strftime("%A %e %B %EY");
  $limit = $1 if $formulas[1] =~ /(\d+)/;
  if ($d <= $limit)
    { $formula = $formulas[0]; $offset = 1792 }
  else
    {
      $limit = $1 if $formulas[2] =~ /(\d+)/;
      if ($d <= $limit)
        { $formula = $formulas[1]; $offset = 1792 }
      else
        { $formula = $formulas[2]; $offset = 1791 }
    }
  $_ = eval "qq($labels{usage2})";
  print;
}

__END__

=encoding utf8

=head1 NAME

eg/labels_en  view on Meta::CPAN

<p>Look at the first table. The Gregorian year <strong>$y</strong> belongs to the interval
<em>$begint&nbsp;-&nbsp;$end_of_interval{$begint}</em> and its last two digits are 
<em>$y2</em>. 
The cell in the corresponding
line and column contains the three letters <em>$word</em>. 
<p>Look at the next three tables. 
The month <strong>$labels{month}[$m-1]</strong> appears in the <em>$labels{title2}{$part}</em> table, at
the head of which is the fomula <em>$labels{year_ttl}&nbsp;-&nbsp;$offset</em>.
So you can compute that the French Revolutionary year is <strong>$ryear</strong>.
Of the three letters <em>$word</em>, the letter <em>$letter</em> appears
in the same table. The corresponding cell contains two formulas: 
<em>@formulas</em>. Choose the one that will convert the day number <strong>$d</strong>
into a number in the 1-30 range. That is, up to and including 
<strong>$limit $labels{month}[$m - 1]</strong>, use
the first formula <em>$formulas[0]</em>, and later use the second formula <em>$formulas[1]</em>.
Since the Gregorian day number is <strong>$d</strong>, you use <em>$formula</em>, and you get
<strong>$abridged</strong>. The final step consists in retrieving the day's full name
and the month's full name in the last table, which gives 
<strong>$rev_date</strong>.
EOT

$labels{usage2} = <<'EOT';
<h3>How to convert $gr_date</h3>
<p>What about September? The first step is the same, and gives the same three letters 
<em>$word</em>.
<p>But <strong>$labels{month}[8]</strong> 
appears both in the 
<em>$labels{title2}{m}</em> 
table, and in the 
<em>$labels{title2}{e}</em> 
table. The first one gives two formulas for the day: 
<em>$formulas[0]</em> 
and 
<em>$formulas[1]</em> (<em>$mletter</em>
column), and one for the year: 
<em>$labels{year_ttl}&nbsp;-&nbsp;1792</em>. 
The second table gives 
<em>$formulas[2]</em> for the day 
(<em>$eletter</em>
column) and 
<em>$labels{year_ttl}&nbsp;-&nbsp;1791</em>
for the year. 
<p>Try the last formula <em>$formulas[2]</em>,
then the prior one <em>$formulas[1]</em>, then the first one <em>$formulas[0]</em>, 
until you have a result greater than or equal to 1.
<p>For <strong>$d $labels{month}[8] $y</strong>, you would choose <em>$formula</em>,
with the corresponding year formula <em>$labels{year_ttl}&nbsp;-&nbsp;$offset</em>,
which gives you <strong>$abridged</strong>, or better
<strong>$rev_date</strong>.
EOT

#
# Instructions for French Rev to Gregorian
#
$labels{usage3} = <<'EOT';
<h3>How to convert $title_date</h3>
<p>Look at the first table. The French Revolutionary year 

eg/labels_en  view on Meta::CPAN

line and column contains the two letters 
<em>$word</em>. 
<p>Look at the next two tables. The month 
<strong>$fr_month[$m-1]</strong> 
appears in the 
<em>$labels{title2}{$part}</em> 
table. Of the two letters 
<em>$word</em>, 
the letter 
<em>$letter</em> 
appears in the same table. The corresponding cell contains two formulas: 
<em>@formulas</em>. 
Choose the one that will convert the day number 
<strong>$d</strong>
into a number in the proper range for the Gregorian month. That is, up to and including 
<strong>$limit $fr_month[$m - 1]</strong>, 
use the first formula 
<em>$formulas[0]</em>, 
and later use the second formula 
<em>$formulas[1]</em>.
Since the French Revolutionary day number is 
<strong>$d</strong>, 
you use <em>$formula</em>. Using the year formula next to the column headers, you get
<strong>$gr_date</strong>.
EOT
$labels{usage4} = <<'EOT';
<h3>Special cases</h3>
<p>For 
<strong>$labels{add_days}</strong>,
there is only one formula, which is much simpler.
<p>For 
<strong>$fr_month[3]</strong>,
the cell is split in two, because there are two formulas for the year,
<em>$labels{year_ttl}&nbsp;+&nbsp;1791</em>
and
<em>$labels{year_ttl}&nbsp;+&nbsp;1792</em>.
<p><strong>$fr_month[5]</strong> 
is in both tables. For
<strong>$fr_month[5] $y</strong>,
in column
<em>$bletter</em>
you obtain the 
<em>$formulas[0]</em>
formula, and in column
<em>$eletter</em>
you obtain the 
<em>$formulas[1]</em>
formula. Except for that, everything else is the same. That is, up to and including 
<strong>$limit $fr_month[5]</strong>, 
use the first formula 
<em>$formulas[0]</em>, 
and later use the second formula 
<em>$formulas[1]</em>.
For example, if you want to convert
<strong>$title_date</strong>, 
since the French Revolutionary day number is 
<strong>$d</strong>, 
you use <em>$formula</em>, and you get
<strong>$gr_date</strong>.
EOT

#
# do cannot return a list value. Therefore, instead of a hash, we return a
# hash reference.
#
\%labels;

eg/labels_fr  view on Meta::CPAN

<em>$labels{title2}{$part}</em>
qui comporte en en-tête la mention
<em>$labels{year_ttl}&nbsp;-&nbsp;$offset</em>.
Vous pouvez donc en déduire tout de suite l'année républicaine, qui est
<strong>$ryear</strong>.
Parmi ces trois lettres
<em>$word</em>, 
la lettre 
<em>$letter</em> 
est celle qui apparaît dans la même table. La case correspondante contient les deux formules&nbsp;:
<em>@formulas</em>. 
Choisissez celle qui convertit le jour
<strong>$d</strong>
en un nombre de 1 à 30. C'est-à-dire, jusqu'à
<strong>$limit $labels{month}[$m - 1]</strong>
inclus, utilisez la première formule
<em>$formulas[0]</em>, 
et ultérieurement, utilisez la deuxième formule
<em>$formulas[1]</em>.
Dans le cas présent, le numéro du jour grégorien est
<strong>$d</strong>, 
donc vous appliquez la formule
<em>$formula</em>, 
et vous obtenez
<strong>$abridged</strong>. 
Il ne reste plus qu'à extraire le nom du jour et le nom du mois de la dernière table, ce qui donne
<strong>$rev_date</strong>.
EOT

$labels{usage2} = <<'EOT';
<h3>Comment convertir $gr_date</h3>
<p>Qu'en est-il de septembre&nbsp;? La première étape est identique, et donne
les trois mêmes lettres
<em>$word</em>.
<p>Mais
<strong>$labels{month}[8]</strong>
figure à la fois dans la table
<em>$labels{title2}{m}</em>
et dans la table
<em>$labels{title2}{e}</em>.
La première donne deux formules pour le jour&nbsp;:
<em>$formulas[0]</em>
et 
<em>$formulas[1]</em>, 
(colonne
<em>$mletter</em>), 
ainsi que
<em>$labels{year_ttl}&nbsp;-&nbsp;1792</em>
pour l'année. L'autre donne
<em>$formulas[2]</em>
pour le jour 
(colonne
<em>$eletter</em>), 
et 
<em>$labels{year_ttl}&nbsp;-&nbsp;1791</em>
pour l'année.
<p>Essayez d'abord la dernière formule
<em>$formulas[2]</em>,
puis la précédente
<em>$formulas[1]</em>, 
et enfin la première
<em>$formulas[0]</em>, 
jusqu'à obtenir un résultat supérieur ou égal à 1.
<p>Dans le cas de
<strong>$d $labels{month}[8] $y</strong>, 
il faut appliquer
<em>$formula</em>,
ainsi que la formule correspondante pour l'année
<em>$labels{year_ttl}&nbsp;-&nbsp;$offset</em>,
ce qui donne
<strong>$abridged</strong>, 
ou mieux,
<strong>$rev_date</strong>.
EOT

#
# Mode d'emploi pour la conversion du calendrier révolutionnaire 

eg/labels_fr  view on Meta::CPAN

<em>$word</em>. 
<p>Et maintenant, reportez-vous aux deux autres tables. Le mois
<strong>$fr_month[$m-1]</strong> 
figure dans la table
<em>$labels{title2}{$part}</em>.
Des deux lettres
<em>$word</em>, 
c'est
<em>$letter</em> 
qui apparaît dans cette table. La case correspondante comporte deux formules&nbsp;:
<em>@formulas</em>. 
Choisissez celle qui vous permet de convertir le numéro de jour
<strong>$d</strong>
et d'obtenir une valeur compatible avec le mois grégorien résultant. 
C'est-à-dire, jusqu'au
<strong>$limit $fr_month[$m - 1]</strong>, 
inclus, utilisez la première formule
<em>$formulas[0]</em>, 
et ensuite, utilisez l'autre formule
<em>$formulas[1]</em>.
Dans le cas présent, le numéro du jour républicain est
<strong>$d</strong>, 
donc vous utilisez la formule 
<em>$formula</em>, 
ce qui donne
<strong>$gr_date</strong>.
EOT
$labels{usage4} = <<'EOT';
<h3>Cas particuliers</h3>
<p>Pour les
<strong>$labels{add_days}</strong>,
il y a une seule formule, ce qui est beaucoup plus simple.
<p>Pour
<strong>$fr_month[3]</strong>,
la case se scinde en deux, car il y a deux formules pour l'année,
<em>$labels{year_ttl}&nbsp;+&nbsp;1791</em>
et
<em>$labels{year_ttl}&nbsp;+&nbsp;1792</em>.
<p><strong>$fr_month[5]</strong> 
se trouve dans les deux tables. Pour
<strong>$fr_month[5] $y</strong>,
dans la colonne
<em>$bletter</em>
vous obtenez la formule
<em>$formulas[0]</em>,
et dans la colonne
<em>$eletter</em>
vous obtenez la formule
<em>$formulas[1]</em>.
À part cela, tout le reste est identique. C'est-à-dire, jusqu'au
<strong>$limit $fr_month[5]</strong>
inclus, utilisez la première formule
<em>$formulas[0]</em>, 
et ensuite, utilisez la formule
<em>$formulas[1]</em>.
Par exemple, si vous voulez convertir
<strong>$title_date</strong>, 
étant donné que le numéro du jour républicain est
<strong>$d</strong>, 
vous devrez utiliser la formule
<em>$formula</em>, 
et vous obtiendrez
<strong>$gr_date</strong>.
EOT

\%labels;

__END__

=encoding utf8

eg/r2g_table  view on Meta::CPAN


binmode STDOUT, ':utf8';

--$columns; # because actually we do not want to be bothered with the heading column

# Because the  Gregorian leap day  may occur in  the middle of  a French
# Revolutionary year,  each F-R  year is divided  into two  parts: begin
# (Vendémiaire  to  mid-Ventôse)  and  end  (mid-Ventôse  to  additional
# days). The French Revolutionary leap  day is not a problem, it appears
# at  the  end of  the  year,  and therefore  has  no  influence on  the
# formulas.
my @parts = ('b', 'e');

# For each year and each part, we store the G day number of a specific F-R day.
# This specific day is
#      b => 1 Vendémiaire => ?? September
#      e => 1 Germinal    => ?? March
# We partially store the reverse : for each part or year and each G day number,
# which year can be taken as an sample.
my @day_of_yearpart;
my %year_of_partday;

eg/r2g_table  view on Meta::CPAN

        print ' ', $year, ' ', word_for_year($year);
        print "\n" if $year % 4 == 0
      }
    print "\n";
  }

# The year -> 2-letter word function is periodic, except for a few glitches
# each time the Gregorian or F-R century changes. So, years are grouped
# by four, eight, twelve or more each group is identified by a 8-, 16- or 
# 24-letter word. Interval are built so if two years n and n+4 (or n+8,
# or n+12) have the same formulas, they may belong to the same interval.
# If the formulas are different, the interval ends and a new interval
# begins.


my %line_for_interval;
my %end_of_interval;
build_intervals();

if (DEBUG)
  {
    print "$_ $end_of_interval{$_} $line_for_interval{$_}\n" 

eg/r2g_table  view on Meta::CPAN

    unless ($old_line =~ m{$intersection} && $new_line =~ m{$intersection}) {
      $current_start = $year;
      $line_for_interval{$year} = $new_line;
    }
    $line_for_interval{$current_start} |= $new_line;
    $end_of_interval{$current_start} = $year;
  }
}

#
# Compute the formulas for a sample year and for a month.
# 1st Vendémiaire I is 22 September 1792, and 30 Vendémiaire I is 21 October I.
# Therefore, for Vendémiaire I, we have two formulas : "+21 Sep" and "-9 Oct".
# Since all French Revolutionary months have 30 days, only one computation is necessary.
# Exception: the additional days are grouped in a notional 13th month, which lasts
# either 5 or 6 days. In this case, we have 3 formulas for September, at the cost of 2 conversions.
#
sub formulas {
  my ($year, $month) = @_;
  my @formulas = ();
  my @month = qw(Sep Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep);
  #my $date = new Date::Convert::French_Rev $year, $month, 1;
  #convert Date::Convert::Gregorian $date;
  my $date = DateTime->from_object(object => DateTime::Calendar::FrenchRevolutionary->new(year => $year, month => $month));
  my $offset = $date->day() - 1;
  push @formulas, "+$offset $labels{month3}[$date->month_0]";
  if ($month < 13)
    {
      #$date = new Date::Convert::French_Rev $year, $month, 30;
      #convert Date::Convert::Gregorian $date;
      $date = DateTime->from_object(object => DateTime::Calendar::FrenchRevolutionary->new(year => $year, month => $month, day => 30));
      $offset = 30 - $date->day();
      push @formulas, "-$offset $labels{month3}[$date->month() - 1]";
    }
  @formulas;
}

sub html_0 {
  my ($title) = @_;
  print <<"EOF";
<html>
<head>
<title>$title</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
</head>

eg/r2g_table  view on Meta::CPAN

}

sub html_2 {
  my ($part)  = @_;
  my @days    = sort { $a <=> $b } keys %{$letter_of_partday{$part}};
  my $colspan = @days + 1;
  print "<p><table border><tr><th align='center' colspan='$colspan'>$labels{title2}{$part}</th></tr>\n";
  if ($part eq 'b')
    {
      html_2header(1791, $part);
      html_two_formulas($part, $_  ) foreach(1..3);
      html_one_formula ($part, 4, 0);
      html_2header(1792, $part);
      html_one_formula ($part, 4, 1);
      html_two_formulas($part, 5);
      html_one_formula ($part, 6, 0);
    }
  else
    {
      html_2header(1792, $part);
      html_one_formula ($part,  6, 1);
      html_two_formulas($part, $_  ) foreach(7..12);
      html_one_formula ($part, 13, 0);
    }

  print "</table>\n";
}

sub html_2header {
  my ($offset, $part) = @_;
  my @letters = sort values %{$letter_of_partday{$part}};
  print "<tr align='center'><th>"
      , join('</th><th>', "$labels{year_ttl} + $offset", @letters)
      , "</th></tr>\n"; 
}

sub html_two_formulas {
  my ($part, $month)  = @_;
  my @days    = sort { $a <=> $b } keys %{$letter_of_partday{$part}};
  print "<tr align='center'><td>$fr_month[$month - 1]</td>";
  foreach (@days)
    {
      my $year = $year_of_partday{$part}{$_};
      my @formulas = formulas($year, $month);
      print "<td>$formulas[0]<br>$formulas[1]</td>\n";
    }
  print "</tr>\n";
}

sub html_one_formula {
  my ($part, $month, $nb)  = @_;
  my @days    = sort { $a <=> $b } keys %{$letter_of_partday{$part}};
  print "<tr align='center'><td>$fr_month[$month - 1]</td>";
  foreach (@days)
    {
      my $year = $year_of_partday{$part}{$_};
      my @formulas = formulas($year, $month);
      print "<td>$formulas[$nb]</td>\n";
    }
  print "</tr>\n";
}

sub usage {
  my ($day) = @_;
  my ($y, $m, $d) = unpack "A4A2A2", sprintf "%08d", $day;
  $y += 0; # Remove the leading zeros
  # We want neither Ventôse nor additional days for the first example,
  # so we choose a random month.

eg/r2g_table  view on Meta::CPAN

  #my $date = new Date::Convert::French_Rev $y, $m, $d;
  #convert Date::Convert::Gregorian $date;
  my $date_r   = DateTime::Calendar::FrenchRevolutionary->new(year => $y, month => $m, day => $d);
  my $date_g   = DateTime->from_object(object => $date_r);
  my $title_date = $date_r->strftime("%d %B %EY");
  my $y2       = sprintf "%02d", $y % 100;
  my $part     = $m <= 6 ? 'b' : 'e';
  my $offset   = $part eq 'e' ? 1792 : 1791;
  my $letter   = letter_of_yearpart($y, $part);
  my $word     = word_for_year($y);
  my @formulas = formulas($y, $m);
  my $limit    = $1 if $formulas[1] =~ /(\d+)/;
  my $formula  = $formulas[$d <= $limit ? 0 : 1];
  my $gyear    = $date_g->year;
  my $gmonth   = $date_g->month;
  my $gday     = $date_g->day;
  my $begint; # Beginning of the interval
  foreach (sort { $a <=> $b } keys %end_of_interval)
    {
      last if $y < $_;
      $begint = $_;
    }
  my $gr_date  = &{$labels{format}}($gyear, $gmonth, $gday, $lang);

eg/r2g_table  view on Meta::CPAN

  print "\n";

  # Second example: Ventôse
  # $m = 6;
  #$date = new Date::Convert::French_Rev $y, 6, $d;
  #$title_date = $date->date_string("%d %B %EY");
  #convert Date::Convert::Gregorian $date;
  $date_r   = DateTime::Calendar::FrenchRevolutionary->new(year => $y, month => 6, day => $d);
  $date_g   = DateTime->from_object(object => $date_r);
  $title_date = $date_r->strftime("%d %B %EY");
  @formulas   = formulas($y, 6);
  my $bletter = letter_of_yearpart($y, 'b');
  my $eletter = letter_of_yearpart($y, 'e');
  $gyear      = $date_g->year;
  $gmonth     = $date_g->month;
  $gday       = $date_g->day;
  $gr_date  = &{$labels{format}}($gyear, $gmonth, $gday, $lang);
  $limit = $1 if $formulas[1] =~ /(\d+)/;
  if ($d <= $limit)
    { $formula = $formulas[0]; $offset = 1791 }
  else
    { $formula = $formulas[1]; $offset = 1792 }
  $_ = eval "qq($labels{usage4})";
  print;
}

__END__

=encoding utf8

=head1 NAME

eg/result/g2r_en.html  view on Meta::CPAN

<p>Look at the first table. The Gregorian year <strong>1799</strong> belongs to the interval
<em>1792&nbsp;-&nbsp;1799</em> and its last two digits are 
<em>99</em>. 
The cell in the corresponding
line and column contains the three letters <em>cfk</em>. 
<p>Look at the next three tables. 
The month <strong>November</strong> appears in the <em>End of Year</em> table, at
the head of which is the fomula <em>Year&nbsp;-&nbsp;1791</em>.
So you can compute that the French Revolutionary year is <strong>8</strong>.
Of the three letters <em>cfk</em>, the letter <em>k</em> appears
in the same table. The corresponding cell contains two formulas: 
<em>+9 Bru -21 Fri</em>. Choose the one that will convert the day number <strong>09</strong>
into a number in the 1-30 range. That is, up to and including 
<strong>21 November</strong>, use
the first formula <em>+9 Bru</em>, and later use the second formula <em>-21 Fri</em>.
Since the Gregorian day number is <strong>09</strong>, you use <em>+9 Bru</em>, and you get
<strong>18 Bru</strong>. The final step consists in retrieving the day's full name
and the month's full name in the last table, which gives 
<strong>Octidi 18 Brumaire VIII</strong>.

<h3>How to convert 09 September 1799</h3>
<p>What about September? The first step is the same, and gives the same three letters 
<em>cfk</em>.
<p>But <strong>September</strong> 
appears both in the 
<em>Middle of Year</em> 
table, and in the 
<em>End of Year</em> 
table. The first one gives two formulas for the day: 
<em>+14 Fru</em> 
and 
<em>-16 S-C</em> (<em>f</em>
column), and one for the year: 
<em>Year&nbsp;-&nbsp;1792</em>. 
The second table gives 
<em>-22 Vnd</em> for the day 
(<em>k</em>
column) and 
<em>Year&nbsp;-&nbsp;1791</em>
for the year. 
<p>Try the last formula <em>-22 Vnd</em>,
then the prior one <em>-16 S-C</em>, then the first one <em>+14 Fru</em>, 
until you have a result greater than or equal to 1.
<p>For <strong>09 September 1799</strong>, you would choose <em>+14 Fru</em>,
with the corresponding year formula <em>Year&nbsp;-&nbsp;1792</em>,
which gives you <strong>23 Fru 0007</strong>, or better
<strong>Tridi 23 Fructidor VII</strong>.
</body>
</html>

eg/result/r2g_en.html  view on Meta::CPAN

line and column contains the two letters 
<em>ch</em>. 
<p>Look at the next two tables. The month 
<strong>Brumaire</strong> 
appears in the 
<em>Beginning of Year</em> 
table. Of the two letters 
<em>ch</em>, 
the letter 
<em>c</em> 
appears in the same table. The corresponding cell contains two formulas: 
<em>+22 Oct -9 Nov</em>. 
Choose the one that will convert the day number 
<strong>18</strong>
into a number in the proper range for the Gregorian month. That is, up to and including 
<strong>9 Brumaire</strong>, 
use the first formula 
<em>+22 Oct</em>, 
and later use the second formula 
<em>-9 Nov</em>.
Since the French Revolutionary day number is 
<strong>18</strong>, 
you use <em>-9 Nov</em>. Using the year formula next to the column headers, you get
<strong>9 November 1799</strong>.

<h3>Special cases</h3>
<p>For 
<strong>Additional Days</strong>,
there is only one formula, which is much simpler.
<p>For 
<strong>Nivôse</strong>,
the cell is split in two, because there are two formulas for the year,
<em>Year&nbsp;+&nbsp;1791</em>
and
<em>Year&nbsp;+&nbsp;1792</em>.
<p><strong>Ventôse</strong> 
is in both tables. For
<strong>Ventôse 8</strong>,
in column
<em>c</em>
you obtain the 
<em>+19 Feb</em>
formula, and in column
<em>h</em>
you obtain the 
<em>-9 Mar</em>
formula. Except for that, everything else is the same. That is, up to and including 
<strong>9 Ventôse</strong>, 
use the first formula 
<em>+19 Feb</em>, 
and later use the second formula 
<em>-9 Mar</em>.
For example, if you want to convert
<strong>18 Ventôse VIII</strong>, 
since the French Revolutionary day number is 
<strong>18</strong>, 
you use <em>-9 Mar</em>, and you get
<strong>9 March 1800</strong>.
</body>
</html>



( run in 0.976 second using v1.01-cache-2.11-cpan-3cd7ad12f66 )