Bugzilla – Attachment 118316 Details for
Bug 27937
Date of birth entered without correct format causes internal server error
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23937: Allow for single date day or month
Bug-23937-Allow-for-single-date-day-or-month.patch (text/plain), 2.34 KB, created by
Nick Clemens (kidclamp)
on 2021-03-16 12:59:57 UTC
(
hide
)
Description:
Bug 23937: Allow for single date day or month
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2021-03-16 12:59:57 UTC
Size:
2.34 KB
patch
obsolete
>From 819f44a4d39a56ad5001968d1ee6f6d0b500623a Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Tue, 16 Mar 2021 12:54:00 +0000 >Subject: [PATCH] Bug 23937: Allow for single date day or month > >When validating dates in JavaScript it is acceptable to have single digit days or months e.g,: >2011-6-16 > >When parsing in Koha::DateUtils->dt_from_string we die on these > >This patch changes the logic to allow for one or two digits in the days and months > >To test: > 1 - Add new patron > 2 - Enter birthdate as 2/11/1986 > 3 - Complete required fields > 4 - Save > 5 - Get ISE > The given date (2/11/1986) does not match the date format (us) at /kohadevbox/koha/Koha/DateUtils.pm line 175 > 6 - Apply patch > 7 - Repeat 1-4 > 8 - Patron successfully added > 9 - Edit patron, try setting DOB to 2/1/1986 >10 - Success! >11 - Repeat with other settings of system preference 'dateformat' > >https://bugs.koha-community.org/show_bug.cgi?id=27937 >--- > Koha/DateUtils.pm | 16 ++++++++-------- > 1 file changed, 8 insertions(+), 8 deletions(-) > >diff --git a/Koha/DateUtils.pm b/Koha/DateUtils.pm >index 9b599e3c6d..6e6eec7ac7 100644 >--- a/Koha/DateUtils.pm >+++ b/Koha/DateUtils.pm >@@ -69,17 +69,17 @@ sub dt_from_string { > my $fallback_re = qr| > (?<year>\d{4}) > - >- (?<month>\d{2}) >+ (?<month>\d{1,2}) > - >- (?<day>\d{2}) >+ (?<day>\d{1,2}) > |xms; > > if ( $date_format eq 'metric' ) { > # metric format is "dd/mm/yyyy[ hh:mm:ss]" > $regex = qr| >- (?<day>\d{2}) >+ (?<day>\d{1,2}) > / >- (?<month>\d{2}) >+ (?<month>\d{1,2}) > / > (?<year>\d{4}) > |xms; >@@ -87,9 +87,9 @@ sub dt_from_string { > elsif ( $date_format eq 'dmydot' ) { > # dmydot format is "dd.mm.yyyy[ hh:mm:ss]" > $regex = qr| >- (?<day>\d{2}) >+ (?<day>\d{1,2}) > . >- (?<month>\d{2}) >+ (?<month>\d{1,2}) > . > (?<year>\d{4}) > |xms; >@@ -97,9 +97,9 @@ sub dt_from_string { > elsif ( $date_format eq 'us' ) { > # us format is "mm/dd/yyyy[ hh:mm:ss]" > $regex = qr| >- (?<month>\d{2}) >+ (?<month>\d{1,2}) > / >- (?<day>\d{2}) >+ (?<day>\d{1,2}) > / > (?<year>\d{4}) > |xms; >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 27937
:
118315
|
118316
|
118317
|
118368
|
119069
|
119070
|
119084