node-red-contrib-moment
Version:
Node-Red Node that produces formatted Date/Time output using the Moment.JS library. Timezone, dst and locale aware.
161 lines • 4.16 kB
JSON
[
{
"id": "320464b5.d0134c",
"type": "moment",
"z": "533475c4.a28eac",
"name": "input: msg.payload",
"topic": "",
"input": "",
"inputType": "msg",
"inTz": "America/New_York",
"adjAmount": 0,
"adjType": "days",
"adjDir": "add",
"format": "YYYY-MM-DD HH:mm",
"locale": "en_US",
"output": "now",
"outputType": "msg",
"outTz": "America/New_York",
"x": 470,
"y": 400,
"wires": [
[
"72ed58b3.7f9178"
]
]
},
{
"id": "aceef80.40a4908",
"type": "inject",
"z": "533475c4.a28eac",
"name": "",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 240,
"y": 340,
"wires": [
[
"320464b5.d0134c"
]
]
},
{
"id": "72ed58b3.7f9178",
"type": "debug",
"z": "533475c4.a28eac",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"x": 650,
"y": 400,
"wires": []
},
{
"id": "bbe21120.87815",
"type": "inject",
"z": "533475c4.a28eac",
"name": "blank string",
"topic": "",
"payload": "",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 230,
"y": 380,
"wires": [
[
"320464b5.d0134c"
]
]
},
{
"id": "e49c12a.d2215f",
"type": "inject",
"z": "533475c4.a28eac",
"name": "'test'",
"topic": "",
"payload": "test",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 250,
"y": 420,
"wires": [
[
"320464b5.d0134c"
]
]
},
{
"id": "58881f8c.6cc45",
"type": "inject",
"z": "533475c4.a28eac",
"name": "null",
"topic": "",
"payload": "null",
"payloadType": "json",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 250,
"y": 460,
"wires": [
[
"320464b5.d0134c"
]
]
},
{
"id": "43a381eb.dae01",
"type": "comment",
"z": "533475c4.a28eac",
"name": "Pass different data types to a valid input property",
"info": "",
"x": 560,
"y": 360,
"wires": []
},
{
"id": "e2fe39e8.d9aba8",
"type": "inject",
"z": "533475c4.a28eac",
"name": "Invalid Date String",
"topic": "Invalid Date String",
"payload": "36th September 3046",
"payloadType": "str",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": "",
"x": 210,
"y": 500,
"wires": [
[
"320464b5.d0134c"
]
]
},
{
"id": "4b9bf042.f40d3",
"type": "comment",
"z": "533475c4.a28eac",
"name": "Expected Results",
"info": "Requests input from `msg.payload` but puts\noutput to `msg.now`.\n\n\n## Timestamp input\n\n```\n{\n \"_msgid\":\"2792614c.a404ee\",\"topic\":\"\",\n \"payload\":1537718900126,\n \"now\":\"2018-09-23 12:08\"\n}\n```\n\n## All other inputs\n\n1. An output warning message\n `The input property was NOT a recognisable date. Output will be a blank string`\n\n2. `msg.payload` set to input msg.payload\n3. `msg.now` set to empty string.\n",
"x": 460,
"y": 460,
"wires": []
}
]