I have array of the objects.Each object in array has date property.I try to get biggest(the last) date from array.
Here is array:
var sensorsData = [
When you create a date with new Date(str)
it creates a date object with a time zone. toISOString()
makes it zero UTC offset, as denoted by the suffix "Z".
Here is a workaround:
var date = new Date(e.MeasureDate)
return new Date(date.getTime() - date.getTimezoneOffset() * 60000)
Updated fiddler: https://jsfiddle.net/xf5jmLL6/7
getTimezoneOffset
returns number of minutes and new Date
expects number of milliseconds since January 1 1970 00:00:00 UTC, so multiplying by 60000 provides needed adjustment.