]> git.koha-community.org Git - koha.git/commit
Bug 13601: Make dt_from_string not using DateTime::Format::DateParse
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 20 Jan 2015 14:28:56 +0000 (15:28 +0100)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Mon, 30 Mar 2015 16:39:57 +0000 (13:39 -0300)
commitc23abea8354008f0bffcd55b0dc9febfb13fe8af
tree0e355bc4543bc9ad1c7d7fdda7bc11087d5aa3a0
parentdd9f456ab7c2f0e66173a6feb7df2a38604c82cd
Bug 13601: Make dt_from_string not using DateTime::Format::DateParse

For a couple of reasons, dt_from_string should not use
DateTime::Format::DateParse:
1/ It does not manage date < 1900, certainly caused by l.47 of this
module:
 $p{ year }      = $year ? $year + 1900 : DateTime->now->year;

2/ It considers 31/01/2015 as a valid us date, which is not.

Test plan:
1/ Verify that
  prove t/DateUtils.t
returns green
2/ Play with dates in Koha (yes I know, it's vague...)
3/ Try to find a regression with dates
4/ Create a date with year <= 1900 and confirm it works

QA comment:
Why the sql format switch was:
-                $date_string =~
-s/(\d{4})(\d{2})(\d{2})\s+(\d{2})(\d{2})(\d{2})/$1-$2-$3T$4:$5:$6/;

From where a date like "yyyymmdd hhmmss" can come?

Tested patches 1 - 3 together. Worked as expected.
Signed-off-by: Marc VĂ©ron <veron@veron.ch>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
Koha/DateUtils.pm