Skip to content

Commit

Permalink
[qif/qif-parse] restore handle non-4-digit dates, and erratum
Browse files Browse the repository at this point in the history
db93aec contained logic error in date-handling, would invalidate
2-digit years.

Also parse-bang-field needs to trim trailing space.
  • Loading branch information
christopherlam committed Aug 5, 2019
1 parent 08de1a0 commit 6252de2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions gnucash/import-export/qif-imp/qif-parse.scm
Expand Up @@ -149,7 +149,7 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

(define (qif-parse:parse-bang-field read-value)
(let ((bang-field (string-downcase! (string-trim read-value))))
(let ((bang-field (string-downcase! (string-trim-right read-value))))
;; The QIF files output by the WWW site of Credit Lyonnais
;; begin by: !type bank
;; instead of: !Type:bank
Expand Down Expand Up @@ -235,8 +235,8 @@
(define (date? d m y ys)
(and (number? d) (<= 1 d 31)
(number? m) (<= 1 m 12)
(= 4 (string-length ys))
(number? y) (> y 1930)))
(number? y) (or (not (= 4 (string-length ys)))
(> y 1930))))
(let* ((date-parts (list (match:substring match 1)
(match:substring match 2)
(match:substring match 3)))
Expand Down
6 changes: 6 additions & 0 deletions gnucash/import-export/qif-imp/test/test-qif-parse.scm
Expand Up @@ -157,6 +157,12 @@
"1979/03/03"
'(d-m-y y-m-d m-d-y y-d-m)))

(test-equal "qif-parse:check-date-format 03/03/79"
'(d-m-y m-d-y)
(qif-parse:check-date-format
"03/03/79"
'(d-m-y y-m-d m-d-y y-d-m)))

(test-equal "qif-parse:check-date-format 19790303"
'(y-m-d y-d-m)
(qif-parse:check-date-format
Expand Down

0 comments on commit 6252de2

Please sign in to comment.