let's continue on koha-devel

Hum, Koha::DateUtils looks buggy too:

use Modern::Perl;
use Koha::DateUtils qw( dt_from_string output_pref );
use DateTime;
use DateTime::Format::DateParse;

my $date_string = '15/06/1800'; # metric in pref

my $dt = dt_from_string( $date_string );
say '1 => ' . output_pref( $dt ) if $dt;

$dt = DateTime->new(year => 1800, month => 06, day => 15);
say '2 => ' . output_pref( $dt ) if $dt;

$date_string = '06/15/1900';
$dt = DateTime::Format::DateParse->parse_datetime( $date_string );
say '3 => ' . output_pref( $dt ) if $dt;

$dt = DateTime::Format::DateParse->parse_datetime( $date_string,
'Europe/Paris' );
say '4 => ' . output_pref( $dt ) if $dt;

Will display:
   2 => 15/06/1800 00:00

The problem comes from DateTime::Format::DateParse.
Somebody knows why we use this module instead of generating a DateTime
object directly from the DateTime module?


2015-01-20 11:18 GMT+01:00 Jonathan Druart <[email protected]>:

> Hello Hugo,
>
> You should try to use Koha::DateUtils, instead of C4::Dates.
> I found some occurrences of "1900" in C4::Dates, maybe there are some
> stuffs hardcoded in it.
> We are going to deprecate C4::Dates.
>
> Cheers,
> Jonathan
>
> 2015-01-20 10:26 GMT+01:00 Hugo Agud <[email protected]>:
> > Dear all,
> >
> > We're experiencing problems filling dates before 1900 in Serial
> startdate,
> > for dats after 1900 it stores fine the date, but for dates before 1900,
> it
> > stores fine in mysql but in intranet shows the date you filled + 1900,
> then
> > you have for example start date 3725.
> >
> > We have tried to modiy Dates.pm but without success, any suggestions? we
> > have not been able to find any bug related
> >
> > thanks you in advance!
> >
> > --
> >
> > *Hugo Agud - Orex Digital *
> >
> > *www.orex.es <http://www.orex.es>*
> >
> >
> > Director
> >
> > Passatge de la Llançadera, 3 · 08338 Premià de Dalt - Tel: 93 539 40 70
> > [email protected] · http://www.orex.es/
> >
> >
> >
> > No imprima este mensaje a no ser que sea necesario. Una tonelada de papel
> > implica la tala de 15 árboles y el consumo de 250.000 litros de agua.
> >
> >
> >
> > Aviso de confidencialidad
> > Este mensaje contiene información que puede ser CONFIDENCIAL y/o de USO
> > RESTRINGIDO. Si usted no es el receptor deseado del mensaje (ni
> > está autorizado a recibirlo por el remitente), no está autorizado a
> copiar,
> > reenviar o divulgar el mensaje o su contenido. Si ha recibido este
> mensaje
> > por error, por favor, notifíquenoslo inmediatamente y bórrelo de su
> sistema.
> > _______________________________________________
> > Koha mailing list  http://koha-community.org
> > [email protected]
> > http://lists.katipo.co.nz/mailman/listinfo/koha
>
_______________________________________________
Koha-devel mailing list
[email protected]
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to