Skip to content
Extraits de code Groupes Projets
Valider 6ed1a681 rédigé par Alexandre Morignot's avatar Alexandre Morignot
Parcourir les fichiers

correct date insertion

parent 72f47240
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
......@@ -13,17 +13,17 @@ our $log;
sub exec {
my ($chanName, $title, $day, $month, $year, $place, $desc) = @_;
my $timestamp = timelocal(0, 59, 23, $day, $month - 1, $year);
my $chan = Sam::Chan->new(name => $chanName);
$year += 2000 if ($year < 2000);
my $chan = Sam::Chan->new(name => $chanName);
unless ($chan->load(speculative => 1)) {
die "ce chan n'est pas encore configuré";
}
my $event = Sam::Event->new(
title => $title,
date => $timestamp,
date => "$year-$month-$day 23:59:00",
place => $place,
description => $desc,
calendar => $chan->calendar
......
......@@ -60,6 +60,8 @@ sub exec {
=xi) {
my (undef, undef, undef, undef, $current_mon, $current_year, undef, undef, undef) =
localtime(time);
$current_mon++; # localtime returns month between 0 and 11
$current_year += 1900; # same shit
my ($title, $place, $desc) = ($+{'title'}, $+{'place'}, $+{'desc'});
my ($day, $month, $year) = ($+{'day'}, $+{'month'} || $current_mon, $+{'year'} || $current_year);
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter