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

**URL:** https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298
**Category:** Dashboard
**Created:** [27 March 2021 20:58 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298 "2021-03-27T20:58:19Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [27 March 2021 20:58 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/1 "2021-03-27T20:58:19Z")

</div>

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

```auto
01.04.2021 09:00

```

but data comes as this format

```auto
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 😕  
can someone point me to the right direction or an example?  
I try to make it with a change node without success 😕

> **[Date/Time functions · JSONata](http://docs.jsonata.org/date-time-functions)**
>
> \## \`$now()\`

Here is my simplified flow

```auto
[{"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}]

```

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [27 March 2021 21:23 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/2 "2021-03-27T21:23:46Z")

</div>

Try this

```auto
events[*].$merge( [$, { "updated": $fromMillis( $toMillis(updated) "[M]-[D]-[Y] [H]:[m]" ) } ] )

```

```auto
[{"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}]

```

---

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [27 March 2021 21:36 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/3 "2021-03-27T21:36:40Z")

</div>

I tried it but still getting same data 😕  
 ![Screen Shot 2021-03-28 at 00.35.10](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/6/c68e1a700db280d6afac8bd976707d895d2d114c.png)

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [27 March 2021 21:44 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/4 "2021-03-27T21:44:04Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [27 March 2021 22:38 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/5 "2021-03-27T22:38:48Z")

</div>

yep I got it thank you

---

<div class="post-metadata">

### Author: ![UnborN](https://avatars.discourse-cdn.com/v4/letter/u/4491bb/32.png) [@UnborN](https://discourse.nodered.org/u/UnborN)
#### Post date: [27 March 2021 22:39 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/6 "2021-03-27T22:39:25Z")

</div>

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.

```javascript
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 :**

```auto
[{"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}]

```

---

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [28 March 2021 12:20 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/7 "2021-03-28T12:20:37Z")

</div>

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

```auto
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
}

```

---

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [28 March 2021 13:35 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/8 "2021-03-28T13:35:25Z")

</div>

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 😕

```auto
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

```auto
[{"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":[]}]

```

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [28 March 2021 13:41 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/9 "2021-03-28T13:41:04Z")

</div>

```auto
{
   "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') 
}

```

---

<div class="post-metadata">

### Author: ![umtksa](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/umtksa/32/38322_2.png) [@umtksa](https://discourse.nodered.org/u/umtksa)
#### Post date: [28 March 2021 17:36 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/10 "2021-03-28T17:36:21Z")

</div>

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?

```auto
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 }

```

---

<div class="post-metadata">

### Author: ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)
#### Post date: [28 March 2021 18:01 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/11 "2021-03-28T18:01:14Z")

</div>

I go to the below links for info

The doc's at

> **[JSONata Documentation · JSONata](https://docs.jsonata.org/overview)**
>
> \## Introduction

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [11 April 2021 18:01 UTC](https://discourse.nodered.org/t/help-needed-editing-api-data-before-using-with-ng-repeat-in-a-template-node/43298/12 "2021-04-11T18:01:21Z")

</div>

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