Hi all!
I have a Rest API that I pull some data from. It looks like this:
[
{
"TripId": 231672455,
"TripStartDateTime": "2019-11-25T05:44:04",
"TripEndDateTime": "2019-11-25T05:52:02",
"DistanceKilometers": 3.26,
"FuelConsumptionInLiters": 0.23,
"TripStartFormattedAddress": "Murgrönsvägen 19, 232 54 Åkarp, Sweden",
"TripEndFormattedAddress": "Harakärrsvägen 13, 232 53 Åkarp, Sweden",
"TripStartCustomAddress": "Hemma",
"TripEndCustomAddress": null,
"VehicleId": 66351,
"TripType": 0,
"DriverContactId": 31932,
"HasSpeedingViolation": false,
"HasIdlingEvent": false,
"HasAccelerationEvent": false,
"HasAccident": false,
"HasTurningEvent": false,
"HasBrakingEvent": false,
"ParkedForMinutesUntilNextTrip": 2,
"HasDrivingEvents": false,
"CustomCategory": null,
"TripTags": null,
"HideStartRoute": false,
"HideEndRoute": false,
"VehicleType": 6,
"TripApprovalStatus": null,
"IsMerged": false,
"HasGermanTaxRules": false,
"IsLocked": false,
"LockReason": 0
},
{
"TripId": 231675778,
"TripStartDateTime": "2019-11-25T05:54:31",
"TripEndDateTime": "2019-11-25T06:12:40",
"DistanceKilometers": 16.04,
"FuelConsumptionInLiters": 1.08,
"TripStartFormattedAddress": "Harakärrsvägen 13, 232 53 Åkarp, Sweden",
"TripEndFormattedAddress": "Kantyxegatan 25L, 213 76 Malmö, Sweden",
"TripStartCustomAddress": null,
"TripEndCustomAddress": null,
"VehicleId": 66351,
"TripType": 0,
"DriverContactId": 31932,
"HasSpeedingViolation": false,
"HasIdlingEvent": false,
"HasAccelerationEvent": false,
"HasAccident": false,
"HasTurningEvent": false,
"HasBrakingEvent": false,
"ParkedForMinutesUntilNextTrip": null,
"HasDrivingEvents": false,
"CustomCategory": null,
"TripTags": null,
"HideStartRoute": false,
"HideEndRoute": false,
"VehicleType": 6,
"TripApprovalStatus": null,
"IsMerged": false,
"HasGermanTaxRules": false,
"IsLocked": false,
"LockReason": 0
}
],
I want to change "TripStartDateTime" and "TripEndDateTime" to the right format (dddd, MMMM Do, YYYY h:mma) first of all and then change the value to +1 hour.
I have managed to get a timestamp in the correct format by using the moment-node but how do I change the value when i call GET from the API?
Is this possible?
I´m really a noob at this and can´t figure out what to do next.
/Mattias