Modifying dateString as per UTC-Offset to satisfactorily filter based on date

let offset =new Date().getTimezoneOffset() 
// will return -330 in India where timezone is GMT+5:30
// will return 480, in USA where timezone is GMT-8
Further we use moment library to modify the date code is as followsimport moment from 'moment-timezone'function addOffsetCorrection(dateString:string):string {
let offset =new Date().getTimezoneOffset();

return moment(dateString).add(offset,'minutes').format('DD/MM/YYYY HH:mm:ss')

// changes '2020:10:20T00:00:00' to '2020:10:19T20:30:00Z' for India
// changes '2020:10:20T00:00:00' to '2020:10:20T08:00:00Z' for USA



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store