Skip to content

Commit 82c5411

Browse files
committed
Merge branch 'feature/indianapolis' into 'master'
Accept non-standard "Indiana/Indianapolis" timezone name. See merge request routine/timmy!28
2 parents 3c1f49f + f448b49 commit 82c5411

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

timmy-timezones/lib/timmy_timezones.ml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ let of_timere timere_tz : Timmy.Timezone.t =
3939

4040
let available_zones = Timedesc.Time_zone.available_time_zones
4141

42-
let of_string tz_name =
43-
let tz = Timedesc.Time_zone.make tz_name in
44-
Option.map ~f:of_timere tz
42+
(** Normalize non-standard timezone names encountered in the wild to their IANA
43+
name. *)
44+
let normalize_tz_name = function
45+
| "Indiana/Indianapolis" -> "America/Indiana/Indianapolis"
46+
| name -> name
47+
48+
let of_string name =
49+
match Timedesc.Time_zone.make @@ normalize_tz_name name with
50+
| None ->
51+
let () = Logs.err (fun m -> m "unknown timezone: %S" name) in
52+
None
53+
| Some tz -> Some (of_timere tz)

0 commit comments

Comments
 (0)