Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Mark Herwege <[email protected]>
  • Loading branch information
mherwege committed Mar 20, 2023
1 parent 25c1a9c commit e537923
Showing 1 changed file with 20 additions and 20 deletions.
40 changes: 20 additions & 20 deletions bundles/org.openhab.ui.basic/web-src/smarthome.js
Original file line number Diff line number Diff line change
Expand Up @@ -1542,17 +1542,17 @@
dotSeparatorPattern = /^-?(([0-9]{1,3}(,[0-9]{3})*)|([0-9]*))?(\.[0-9]+)?$/,
commaSeparatorPattern = /^-?(([0-9]{1,3}(\.[0-9]{3})*)|([0-9]*))?(,[0-9]+)?$/;

// This kicks in when the browser does not support date, time or datetime-local input elements.
// Set the placeholder to the right patterns. This cannot be done in the snippet creation in Java because the browser is unknown there.
if (_t.itemType === "datetime" && _t.inputHint && _t.input.type === "text") {
var placeholder = "YYYY-MM-DD hh:mm:ss";
if (_t.inputHint === "date") {
placeholder = "YYYY-MM-DD";
} else if (_t.inputHint === "time") {
placeholder = "hh:mm:ss";
}
_t.parentNode.querySelector("label").innerHTML = placeholder;
}
// This kicks in when the browser does not support date, time or datetime-local input elements.
// Set the placeholder to the right patterns. This cannot be done in the snippet creation in Java because the browser is unknown there.
if (_t.itemType === "datetime" && _t.inputHint && _t.input.type === "text") {
var placeholder = "YYYY-MM-DD hh:mm:ss";
if (_t.inputHint === "date") {
placeholder = "YYYY-MM-DD";
} else if (_t.inputHint === "time") {
placeholder = "hh:mm:ss";
}
_t.parentNode.querySelector("label").innerHTML = placeholder;
}

function parseNumber(value) {
var newValue = value.trim();
Expand Down Expand Up @@ -1624,7 +1624,7 @@
}

_t.setValuePrivate = function(value, itemState) {
var state = (itemState === "undefined" || itemState === "UNDEF" || itemState === "NULL") ? "" : itemState;
var state = (itemState === "undefined" || itemState === "UNDEF" || itemState === "NULL") ? "" : itemState;

if (_t.verify) {
_t.verify.cancel();
Expand All @@ -1641,15 +1641,15 @@
_t.input.parentNode.nextElementSibling.innerHTML = valueArray[1];
}
} else if (_t.itemType === "datetime") {
if (_t.inputHint) {
newValue = state ? state : value;
}
if (_t.inputHint) {
newValue = state ? state : value;
}
newValue = newValue.trim().split(".")[0];
if (_t.inputHint === "date") {
newValue = newValue.split("T")[0];
} else if (_t.inputHint === "time") {
newValue = newValue.split("T")[1];
}
if (_t.inputHint === "date") {
newValue = newValue.split("T")[0];
} else if (_t.inputHint === "time") {
newValue = newValue.split("T")[1];
}
if (_t.input.type === "text") {
newValue = newValue.replace("T", " ");
}
Expand Down

0 comments on commit e537923

Please sign in to comment.