Re: [Koha-devel] [Koha] question serials start date
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@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
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,
2015-01-20 10:26 GMT+01:00 Hugo Agud <hagud@orex.es>: 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@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@lists.katipo.co.nz http://lists.katipo.co.nz/mailman/listinfo/koha
On Tue, Jan 20, 2015 at 11:28:16AM +0100, Jonathan Druart wrote:
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?
I think it was only there to ease transition from the old C4 date routines. In new code generating a DateTime would probably be the way to go. Were we building things from scratch we'd probably set the options for DBIx::Class to return dates as DateTime objects C. -- Colin Campbell Chief Software Engineer, PTFS Europe Limited Content Management and Library Solutions +44 (0) 800 756 6803 (phone) +44 (0) 7759 633626 (mobile) colin.campbell@ptfs-europe.com skype: colin_campbell2 http://www.ptfs-europe.com
Thanks Colin! I have just opened bug 13601, I will add a patch soon to remove the use of DateTime::Format::DateParse. 2015-01-20 12:42 GMT+01:00 Colin Campbell <colin.campbell@ptfs-europe.com>:
On Tue, Jan 20, 2015 at 11:28:16AM +0100, Jonathan Druart wrote:
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?
I think it was only there to ease transition from the old C4 date routines. In new code generating a DateTime would probably be the way to go. Were we building things from scratch we'd probably set the options for DBIx::Class to return dates as DateTime objects
C.
-- Colin Campbell Chief Software Engineer, PTFS Europe Limited Content Management and Library Solutions +44 (0) 800 756 6803 (phone) +44 (0) 7759 633626 (mobile) colin.campbell@ptfs-europe.com skype: colin_campbell2
http://www.ptfs-europe.com _______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org 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/
participants (2)
-
Colin Campbell -
Jonathan Druart