Skip to content

Commit

Permalink
Update: dates: consider 0 as empty
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Sagot committed Oct 26, 2019
1 parent a33b650 commit 05bdb4d
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions lib/update.ml
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,10 @@ let get var key env =
Some v -> v
| None -> failwith (var ^ "_" ^ key ^ " unbound")

let get_number var key env = p_getint env (var ^ "_" ^ key)
let get_number var key env =
match p_getint env (var ^ "_" ^ key) with
| Some x when x > 0 -> Some x
| _ -> None

let bad_date conf d =
let err =
Expand All @@ -836,7 +839,9 @@ let bad_date conf d =
raise @@ ModErr err

let int_of_field s =
try Some (int_of_string (String.trim s)) with Failure _ -> None
match int_of_string (String.trim s) with
| x when x > 0 -> Some x
| _ | exception Failure _ -> None

let reconstitute_date_dmy2 conf var =
let m =
Expand Down

0 comments on commit 05bdb4d

Please sign in to comment.