[qif/qif-parse] restore handle non-4-digit dates, and erratum

db93aec58 contained logic error in date-handling, would invalidate
2-digit years.

Also parse-bang-field needs to trim trailing space.
This commit is contained in:
Christopher Lam 2019-08-05 07:37:16 +08:00
parent 08de1a0ab0
commit 6252de21fd
2 changed files with 9 additions and 3 deletions

View File

@ -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
@ -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)))

View File

@ -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