Help needed editing api data before using with ng-repeat in a template node

Hi all I'm getting data from google calender,
data comes as an array of events,
Than with a template node and ng-repeat I'm getting this data to my dashboard.
Now I'm trying to find a solution to convert date data from this api to more human readable format like

01.04.2021 09:00

but data comes as this format

2021-04-01T09:00:00+03:00

I guess jsonata date and time functions can help me but I cannot find a way to use it :confused:
can someone point me to the right direction or an example?
I try to make it with a change node without success :confused:

Here is my simplified flow

[{"id":"2f54fd4e.9ac88a","type":"inject","z":"8b953003.204528","name":"","props":[{"p":"events","v":"[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233751418198000\\\"\",\"id\":\"_8cpjaha48cqk8ba48h2j6b9k690k2b9p6t1jeba66sq38gph60rjidpl88778c\",\"status\":\"confirmed\",\"htmlLink\":\"XzhjcGphaGE0OG4545NxazhiYT67676Q4aDJqNmI5azY5MGsyYjlwNnQxamViYTY2c3EzOGdwaDYwcmppZHBsOGNfMjAyMTA0MTBUMTAwMDAwWiBtYWlsQHN0dWRpb21vaS5jbw\",\"created\":\"2021-03-27T20:03:12.000Z\",\"updated\":\"2021-03-27T20:08:29.099Z\",\"summary\":\"Long title event from calendar\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T13:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"end\":{\"dateTime\":\"2021-04-10T14:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"recurrence\":[\"RRULE:FREQ=YEARLY\"],\"iCalUID\":\"C35EDC5D-DDE3-42AA-97C7-F744C107975C\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754590872000\\\"\",\"id\":\"7rskp14sfcmhh1gfpfcbck66mk\",\"status\":\"confirmed\",\"htmlLink\":\"N3Jza3AxNHNmY21oaDFnZnBmY2JjazY2bWsgbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:12.000Z\",\"updated\":\"2021-03-27T20:34:55.436Z\",\"summary\":\"test 1\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-03-31T23:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T00:00:00+03:00\"},\"iCalUID\":\"google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754641734000\\\"\",\"id\":\"23a83ocucpgm7i1sledi0s9aih\",\"status\":\"confirmed\",\"htmlLink\":\"MjNhODNvY3VjcGdtN2kxc2xlZGkwczlhaWggbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:29.000Z\",\"updated\":\"2021-03-27T20:35:20.867Z\",\"summary\":\"test2\",\"description\":\"event with notes bla bla bla bla bla bla bla\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T09:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T10:00:00+03:00\"},\"iCalUID\":\"23a83ocucpgm7i1sledi0s9aih@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754699292000\\\"\",\"id\":\"5lls8ejus9msd1nchagl8aab1o\",\"status\":\"confirmed\",\"htmlLink\":\"NWxsczhlanVzOW1zZDFuY2hhZ2w4YWFiMW8gbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T20:35:49.000Z\",\"updated\":\"2021-03-27T20:35:49.646Z\",\"summary\":\"test A\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T00:15:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T01:15:00+03:00\"},\"iCalUID\":\"5lls8ejus9msd1nchagl8aab1o@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","x":170,"y":400,"wires":[["da8d12f.c3782f"]]},{"id":"da8d12f.c3782f","type":"change","z":"8b953003.204528","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":440,"y":400,"wires":[["2fec0edb.b54572"]]},{"id":"2fec0edb.b54572","type":"ui_template","z":"8b953003.204528","group":"8f918d7.5af32f","name":"test calendar","order":6,"width":2,"height":5,"format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');    \n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:5px;\n\twidth: 215px;\n}\n.event {\n    max-width:210px\n\twidth: 210px;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\n</style>\n\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n\n<div class=\"event\"><p class=\"pisim\">{{item.summary}}</p></div>\n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.start.dateTime}}</p></div> \n<hr>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":750,"y":400,"wires":[[]]},{"id":"8f918d7.5af32f","type":"ui_group","name":"all","tab":"c1dcfb03.ffed9","order":5,"disp":false,"width":13,"collapse":false},{"id":"c1dcfb03.ffed9","type":"ui_tab","name":"dash","icon":"dashboard","order":1}]

Try this

events[*].$merge( [$, { "updated": $fromMillis( $toMillis(updated) "[M]-[D]-[Y] [H]:[m]" ) } ] )
[{"id":"2f54fd4e.9ac88a","type":"inject","z":"5a245aa1.510164","name":"","props":[{"p":"events","v":"[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233751418198000\\\"\",\"id\":\"_8cpjaha48cqk8ba48h2j6b9k690k2b9p6t1jeba66sq38gph60rjidpl88778c\",\"status\":\"confirmed\",\"htmlLink\":\"XzhjcGphaGE0OG4545NxazhiYT67676Q4aDJqNmI5azY5MGsyYjlwNnQxamViYTY2c3EzOGdwaDYwcmppZHBsOGNfMjAyMTA0MTBUMTAwMDAwWiBtYWlsQHN0dWRpb21vaS5jbw\",\"created\":\"2021-03-27T20:03:12.000Z\",\"updated\":\"2021-03-27T20:08:29.099Z\",\"summary\":\"Long title event from calendar\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T13:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"end\":{\"dateTime\":\"2021-04-10T14:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"recurrence\":[\"RRULE:FREQ=YEARLY\"],\"iCalUID\":\"C35EDC5D-DDE3-42AA-97C7-F744C107975C\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754590872000\\\"\",\"id\":\"7rskp14sfcmhh1gfpfcbck66mk\",\"status\":\"confirmed\",\"htmlLink\":\"N3Jza3AxNHNmY21oaDFnZnBmY2JjazY2bWsgbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:12.000Z\",\"updated\":\"2021-03-27T20:34:55.436Z\",\"summary\":\"test 1\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-03-31T23:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T00:00:00+03:00\"},\"iCalUID\":\"google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754641734000\\\"\",\"id\":\"23a83ocucpgm7i1sledi0s9aih\",\"status\":\"confirmed\",\"htmlLink\":\"MjNhODNvY3VjcGdtN2kxc2xlZGkwczlhaWggbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:29.000Z\",\"updated\":\"2021-03-27T20:35:20.867Z\",\"summary\":\"test2\",\"description\":\"event with notes bla bla bla bla bla bla bla\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T09:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T10:00:00+03:00\"},\"iCalUID\":\"23a83ocucpgm7i1sledi0s9aih@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754699292000\\\"\",\"id\":\"5lls8ejus9msd1nchagl8aab1o\",\"status\":\"confirmed\",\"htmlLink\":\"NWxsczhlanVzOW1zZDFuY2hhZ2w4YWFiMW8gbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T20:35:49.000Z\",\"updated\":\"2021-03-27T20:35:49.646Z\",\"summary\":\"test A\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T00:15:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T01:15:00+03:00\"},\"iCalUID\":\"5lls8ejus9msd1nchagl8aab1o@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","payloadType":"str","x":80,"y":3540,"wires":[["da8d12f.c3782f"]]},{"id":"da8d12f.c3782f","type":"change","z":"5a245aa1.510164","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"events[*].\t   $merge(\t       [\t           $,\t           {\t               \"updated\": $fromMillis(\t                   $toMillis(updated),\t                   \"[M]-[D]-[Y] [H]:[m]\"\t               )\t           }\t       ]\t   )\t","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":270,"y":3540,"wires":[["c354c6a3.09a65","2fec0edb.b54572"]]},{"id":"2fec0edb.b54572","type":"ui_template","z":"5a245aa1.510164","group":"8f918d7.5af32f","name":"test calendar","order":6,"width":2,"height":5,"format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');    \n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:5px;\n\twidth: 215px;\n}\n.event {\n    max-width:210px\n\twidth: 210px;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\n</style>\n\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n\n<div class=\"event\"><p class=\"pisim\">{{item.summary}}</p></div>\n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.start.dateTime}}</p></div> \n<hr>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":660,"y":3540,"wires":[[]]},{"id":"8f918d7.5af32f","type":"ui_group","name":"all","tab":"c1dcfb03.ffed9","order":5,"disp":false,"width":13,"collapse":false},{"id":"c1dcfb03.ffed9","type":"ui_tab","name":"dash","icon":"dashboard","order":1}]

I tried it but still getting same data :confused:
Screen Shot 2021-03-28 at 00.35.10

My example shows you how to alter the time string in events[*].updated. Check the debug after the change node to see the change in the updated property of the events object

There are many time strings in your events object. you will need to take my example and apply it to the properties you wish to change, as i have no idea which ones you need to change.

yep I got it thank you

If you don't need all those fields in the msg you can use Jsonata to restructure your events and pick the fields you need and at the same time use $moment to reformat your datetime.

events.{ 
    "created": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
    "startDate" : $moment(start.dateTime).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
    "endDate" : $moment(end.dateTime).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
    "summary": summary,
    "description": description, 
    "creator": creator,
    "status": status
}

Example Flow :

[{"id":"2f54fd4e.9ac88a","type":"inject","z":"bbf07224.7cc398","name":"","props":[{"p":"events","v":"[{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233751418198000\\\"\",\"id\":\"_8cpjaha48cqk8ba48h2j6b9k690k2b9p6t1jeba66sq38gph60rjidpl88778c\",\"status\":\"confirmed\",\"htmlLink\":\"XzhjcGphaGE0OG4545NxazhiYT67676Q4aDJqNmI5azY5MGsyYjlwNnQxamViYTY2c3EzOGdwaDYwcmppZHBsOGNfMjAyMTA0MTBUMTAwMDAwWiBtYWlsQHN0dWRpb21vaS5jbw\",\"created\":\"2021-03-27T20:03:12.000Z\",\"updated\":\"2021-03-27T20:08:29.099Z\",\"summary\":\"Long title event from calendar\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-10T13:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"end\":{\"dateTime\":\"2021-04-10T14:00:00+03:00\",\"timeZone\":\"Etc/GMT-3\"},\"recurrence\":[\"RRULE:FREQ=YEARLY\"],\"iCalUID\":\"C35EDC5D-DDE3-42AA-97C7-F744C107975C\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754590872000\\\"\",\"id\":\"7rskp14sfcmhh1gfpfcbck66mk\",\"status\":\"confirmed\",\"htmlLink\":\"N3Jza3AxNHNmY21oaDFnZnBmY2JjazY2bWsgbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:12.000Z\",\"updated\":\"2021-03-27T20:34:55.436Z\",\"summary\":\"test 1\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-03-31T23:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T00:00:00+03:00\"},\"iCalUID\":\"google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754641734000\\\"\",\"id\":\"23a83ocucpgm7i1sledi0s9aih\",\"status\":\"confirmed\",\"htmlLink\":\"MjNhODNvY3VjcGdtN2kxc2xlZGkwczlhaWggbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T19:57:29.000Z\",\"updated\":\"2021-03-27T20:35:20.867Z\",\"summary\":\"test2\",\"description\":\"event with notes bla bla bla bla bla bla bla\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T09:00:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T10:00:00+03:00\"},\"iCalUID\":\"23a83ocucpgm7i1sledi0s9aih@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"},{\"kind\":\"calendar#event\",\"etag\":\"\\\"3233754699292000\\\"\",\"id\":\"5lls8ejus9msd1nchagl8aab1o\",\"status\":\"confirmed\",\"htmlLink\":\"NWxsczhlanVzOW1zZDFuY2hhZ2w4YWFiMW8gbWFpbEBzdHVkaW9tb2kuY28\",\"created\":\"2021-03-27T20:35:49.000Z\",\"updated\":\"2021-03-27T20:35:49.646Z\",\"summary\":\"test A\",\"creator\":{\"email\":\"mail@test.com\",\"self\":true},\"organizer\":{\"email\":\"mail@test.com\",\"self\":true},\"start\":{\"dateTime\":\"2021-04-01T00:15:00+03:00\"},\"end\":{\"dateTime\":\"2021-04-01T01:15:00+03:00\"},\"iCalUID\":\"5lls8ejus9msd1nchagl8aab1o@google.com\",\"sequence\":0,\"reminders\":{\"useDefault\":true},\"eventType\":\"default\"}]","vt":"json"}],"repeat":"","crontab":"","once":true,"onceDelay":"1","topic":"","x":130,"y":280,"wires":[["da8d12f.c3782f"]]},{"id":"da8d12f.c3782f","type":"change","z":"bbf07224.7cc398","name":"","rules":[{"t":"set","p":"events","pt":"msg","to":"payload.items","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":320,"y":280,"wires":[["824c6300.16ce","772e3fa3.9ffcd8"]]},{"id":"2fec0edb.b54572","type":"ui_template","z":"bbf07224.7cc398","group":"8f918d7.5af32f","name":"test calendar","order":6,"width":"13","height":"8","format":"<style>\n@import url('https://fonts.googleapis.com/css2?family=Roboto&display=swap');    \n.boxcal {\n\tbackground: #ffffff;\n\tmargin-left: 0px;\n\tmargin-top:0px;\n\tpadding-left:5px;\n\twidth: 215px;\n}\n.event {\n    max-width:210px\n\twidth: 210px;\n}\np.pisim {\n    text-transform:uppercase;\n    font-family: 'Roboto', sans-serif;\n    font-size:20px;\n    color:#000000;\n}\np.pdesc {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\np.ptime {\n    font-family: 'Roboto', sans-serif;\n    font-size:10px;\n    color:#000000;\n}\n</style>\n\n<div ng-repeat=\"item in msg.events\" class=\"boxcal\">\n\n<div class=\"event\"><p class=\"pisim\">{{item.summary}}</p></div>\n<div class=\"event\"><p class=\"pdesc\">{{item.description}}</p></div> \n<div class=\"event\"><p class=\"ptime\">{{item.startDate}}</p></div> \n<hr>\n</div>","storeOutMessages":false,"fwdInMessages":false,"resendOnRefresh":false,"templateScope":"local","x":850,"y":280,"wires":[[]]},{"id":"772e3fa3.9ffcd8","type":"debug","z":"bbf07224.7cc398","name":"1","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":430,"y":220,"wires":[]},{"id":"824c6300.16ce","type":"change","z":"bbf07224.7cc398","name":"format events/dates","rules":[{"t":"set","p":"events","pt":"msg","to":"\tevents.{ \t    \"created\": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t    \"startDate\" : $moment(start.dateTime).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t    \"endDate\" : $moment(end.dateTime).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),\t    \"summary\": summary,\t    \"description\": description, \t    \"creator\": creator,\t    \"status\": status\t}  ","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":580,"y":280,"wires":[["6f66ba96.b7862c","2fec0edb.b54572"]]},{"id":"6f66ba96.b7862c","type":"debug","z":"bbf07224.7cc398","name":"2","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":710,"y":220,"wires":[]},{"id":"8f918d7.5af32f","type":"ui_group","name":"all","tab":"c1dcfb03.ffed9","order":5,"disp":false,"width":13,"collapse":false},{"id":"c1dcfb03.ffed9","type":"ui_tab","name":"dash","icon":"dashboard","order":1}]
1 Like

wow thank you,
now I can seperate time and date with this

events.{ 
    "created": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),
    "startDate" : $moment(start.dateTime).tz('Europe/Athens').format('DD.MM.YYYY'),
    "endDate" : $moment(end.dateTime).tz('Europe/Athens').format('DD.MM.YYYY'),
    "endTime" : $moment(end.dateTime).tz('Europe/Athens').format('HH:mm'),
    "startTime" : $moment(start.dateTime).tz('Europe/Athens').format('HH:mm'),
    "summary": summary,
    "description": description, 
    "creator": creator,
    "status": status
}

now I'm trying same thing to use somewhere else
but I cannot make it work to convert timestampt to formated date with JSONata
I guess there is a problem my understanding of JSONata :confused:

test.{ 
    "nowhere": $moment(payload).tz('Europe/Istanbul').format('YYYY-MM-DD[T]HH:mm[:00.000Z]'),
    "towhere": $moment(payload).tz('Europe/Istanbul').format('YYYY-MM-DD').add(7, 'days')
}

and here is the test flow

[{"id":"77fc6798.575e08","type":"inject","z":"8b953003.204528","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":400,"y":340,"wires":[["1ebb577d.3c7b71"]]},{"id":"1ebb577d.3c7b71","type":"json","z":"8b953003.204528","name":"","property":"payload","action":"str","pretty":false,"x":590,"y":340,"wires":[["1d431c01.dff464","81a5e948.7a951"]]},{"id":"1d431c01.dff464","type":"debug","z":"8b953003.204528","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":340,"wires":[]},{"id":"81a5e948.7a951","type":"change","z":"8b953003.204528","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"test.{      \"nowhere\": $moment(payload).tz('Europe/Istanbul').format('YYYY-MM-DD[T]HH:mm[:00.000Z]'),     \"towhere\": $moment(payload).tz('Europe/Istanbul').format('YYYY-MM-DD').add(7, 'days') }","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":620,"y":440,"wires":[["328ee758.ede54"]]},{"id":"328ee758.ede54","type":"debug","z":"8b953003.204528","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":910,"y":440,"wires":[]}]
{
   "nowhere": $moment(payload).tz('Europe/Istanbul').format('YYYY-MM-DD[T]HH:mm[:00.000Z]'),
   "towhere": $moment(payload).add(7, 'days').tz('Europe/Istanbul').format('YYYY-MM-DD') 
}

I can even use .fromnow()
this is a big improvement to my dashboard thank you guys @E1cid and @UnborN

Is there any good sources to learn more about JSONata?

events.{       "created": $moment(created).tz('Europe/Athens').format('DD.MM.YYYY HH:mm'),      "startDate" : $moment(start.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),       "endDate" : $moment(end.dateTime).tz('Europe/Istanbul').format('DD.MM.YYYY'),       "endTime" : $moment(end.dateTime).tz('Europe/Istanbul').format('HH:mm'),       "startTime" : $moment(start.dateTime).tz('Europe/Istanbul').format('HH:mm'),   "startDatehuman" : $moment(start.dateTime).tz('Europe/Istanbul').fromNow(),     "summary": summary,       "description": description,        "creator": creator,       "status": status   }

I go to the below links for info

The doc's at

And for moment()
https://momentjs.com/docs/

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.