SVGHMI: prevent exception with date/time formating in sprintf.js if lang wasn't already set.
--- a/svghmi/sprintf.js Wed May 25 09:51:22 2022 +0200
+++ b/svghmi/sprintf.js Wed May 25 09:52:50 2022 +0200
@@ -114,8 +114,14 @@
/* get lang from globals */
let lang = get_current_lang_code();
- arg = Date(arg).toLocaleString('en-US', options);
-
+ let f;
+ try{
+ f = new Intl.DateTimeFormat(lang, options);
+ } catch(e) {
+ f = new Intl.DateTimeFormat('en-US', options);
+ }
+ arg = f.format(arg);
+
/*
TODO: select with padding char
a: absolute time and date (default)