Hello all,
I have a problem with the drop-down-node.
I want to display a date and time in the dorp-down-node. It displays the time +2h.
The debug-node and also the "normal" text-node displays the correct time.
I don't know what's wrong my flow. (see below).
Can anyone help?
[
{
"id": "6747fdd7d7f05f64",
"type": "function",
"z": "2fbf1c672ac8808f",
"name": "All",
"func": "//var executed = global.get('executedAll') || false;\n\nvar start_date = new Date(global.get('start_date'));\nvar end_date = new Date(global.get('end_date'));\nvar unit = global.get('unit')\n\nvar formattedStartDate = start_date.getFullYear() + '-' + ('0' + (start_date.getMonth() + 1)).slice(-2) + '-' + ('0' + start_date.getDate()).slice(-2);\nvar formattedEndDate = end_date.getFullYear() + '-' + ('0' + (end_date.getMonth() + 1)).slice(-2) + '-' + ('0' + end_date.getDate()).slice(-2);\n\nmsg.topic = \"SELECT Datum, Grund, Druck_Vorher, Druck_Nachher FROM opccleaning WHERE Ja = 1 AND Date(Datum) BETWEEN Date(STR_TO_DATE('\" + formattedStartDate + \"', '%Y-%m-%d')) AND Date(STR_TO_DATE('\" + formattedEndDate + \"', '%Y-%m-%d')) AND unit = '\" + unit + \"'\"; \n\nreturn msg;\n\n",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 650,
"y": 160,
"wires": [
[
"a773858c40e2dd5c"
]
]
},
{
"id": "a773858c40e2dd5c",
"type": "mysql",
"z": "2fbf1c672ac8808f",
"mydb": "01f3806be55a308a",
"name": "OPCCleaning",
"x": 800,
"y": 160,
"wires": [
[
"7961a6d6f80119e8"
]
]
},
{
"id": "7961a6d6f80119e8",
"type": "function",
"z": "2fbf1c672ac8808f",
"name": "data drop-down",
"func": "\nmsg.options = [];//create empty array\n\nfor(let i = 0; i < msg.payload.length; i++)\n{\n let row = msg.payload[i]; //get the row\n let opt = {};//make new opt object\n opt[row.Datum] =new Date(row.Datum).toISOString().slice(0,-1); \n msg.options.push(opt);//add the opt to array \n}\nreturn msg;\n\n\n\n/*for(let i = 0; i < msg.payload.length; i++)\n{\n let row = msg.payload[i]; // Holen Sie sich die Zeile\n if(row.Datum) { \n let opt = {}; // Erstellen Sie ein neues opt-Objekt\n let dateWithoutTimezone = new Date(row.Datum).toISOString().slice(0, -1); // Entfernen Sie die Zeitzone aus dem Datum\n opt[row.Datum] = dateWithoutTimezone; \n msg.options.push(opt); // Fügen Sie das opt zum Array hinzu \n }\n}\nreturn msg;\n*/",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 200,
"y": 240,
"wires": [
[
"4c7b4463f6dd1361",
"459d2624ee277bfa"
]
]
},
{
"id": "4c7b4463f6dd1361",
"type": "ui_dropdown",
"z": "2fbf1c672ac8808f",
"name": "",
"label": "",
"tooltip": "",
"place": "Select option",
"group": "9150c527f9189d07",
"order": 24,
"width": 15,
"height": 1,
"passthru": true,
"multiple": false,
"options": [
{
"label": "",
"value": "",
"type": "str"
}
],
"payload": "",
"topic": "topic",
"topicType": "msg",
"className": "",
"x": 380,
"y": 280,
"wires": [
[]
]
},
{
"id": "01f3806be55a308a",
"type": "MySQLdatabase",
"name": "messwerte",
"host": "127.0.0.1",
"port": "3306",
"db": "messwerte",
"tz": "'local'",
"charset": "UTF8"
},
{
"id": "9150c527f9189d07",
"type": "ui_group",
"name": "Cleaning",
"tab": "6da2769d8f177f9c",
"order": 1,
"disp": false,
"width": 19,
"collapse": false,
"className": ""
},
{
"id": "6da2769d8f177f9c",
"type": "ui_tab",
"name": "Reinigung",
"icon": "fa-eraser",
"order": 2,
"disabled": false,
"hidden": false
}
]