summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xLedgerSMB.pm11
-rw-r--r--LedgerSMB/Form.pm10
2 files changed, 11 insertions, 10 deletions
diff --git a/LedgerSMB.pm b/LedgerSMB.pm
index 1ca1ec13..b754e8d0 100755
--- a/LedgerSMB.pm
+++ b/LedgerSMB.pm
@@ -589,13 +589,13 @@ sub date_to_number {
my ( $yy, $mm, $dd );
if ( $date && $date =~ /\D/ ) {
- if ( $myconfig->{dateformat} =~ /^yy/ ) {
+ if ( $date =~ /^\d{4}-\d\d-\d\d$/ ) {
( $yy, $mm, $dd ) = split /\D/, $date;
- }
- elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
+ } elsif ( $myconfig->{dateformat} =~ /^yy/ ) {
+ ( $yy, $mm, $dd ) = split /\D/, $date;
+ } elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
( $mm, $dd, $yy ) = split /\D/, $date;
- }
- elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
+ } elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
( $dd, $mm, $yy ) = split /\D/, $date;
}
@@ -791,3 +791,4 @@ sub set {
1;
+
diff --git a/LedgerSMB/Form.pm b/LedgerSMB/Form.pm
index 02bd44aa..6dac3922 100644
--- a/LedgerSMB/Form.pm
+++ b/LedgerSMB/Form.pm
@@ -977,13 +977,13 @@ sub datetonum {
my $mm;
my $dd;
- if ( $myconfig->{dateformat} =~ /^yy/ ) {
+ if ( $date =~ /^\d{4}-\d\d-\d\d$/ ) {
( $yy, $mm, $dd ) = split /\D/, $date;
- }
- elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
+ } if ( $myconfig->{dateformat} =~ /^yy/ ) {
+ ( $yy, $mm, $dd ) = split /\D/, $date;
+ } elsif ( $myconfig->{dateformat} =~ /^mm/ ) {
( $mm, $dd, $yy ) = split /\D/, $date;
- }
- elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
+ } elsif ( $myconfig->{dateformat} =~ /^dd/ ) {
( $dd, $mm, $yy ) = split /\D/, $date;
}