[Koha-devel] [Koha] question serials start date

Jonathan Druart jonathan.druart at biblibre.com
Tue Jan 20 11:28:16 CET 2015


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 <jonathan.druart at biblibre.com>:

> 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 <hagud at orex.es>:
> > 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
> > hagud at orex.es · 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
> > Koha at lists.katipo.co.nz
> > http://lists.katipo.co.nz/mailman/listinfo/koha
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20150120/9d6c2fb4/attachment.html>


More information about the Koha-devel mailing list