Reputation: 2157
I am pretty new to AngularJS. I am capturing a Datetime attribute in the UI and need to send it to the Odata end point. The time sent is not the current local time. How can I convert the time in to Local time before sending it to the Odata
<div>
<label style="font-size: medium">Collection Time</label>
<div name="collectionTime" uib-timepicker ng-model="sample.collectionTime"
hour-step="hstep" minute-step="mstep" show-meridian="ismeridian" required>
</div>
</div>
The Controller
var data = {
"JAX_SAMPLELOT_TIMECOLLECTED": sample.collectionTime
}
Upvotes: 1
Views: 68
Reputation: 37
Check out https://www.w3schools.com/jsref/jsref_obj_date.asp for further Javascript Date object.
Upvotes: 0
Reputation: 7095
Here we use https://momentjs.com/ in some project and https://github.com/date-fns/date-fns in some other projects, they are both good options to convert time.
Upvotes: 1