In angular 2 with webpack and ts, What is the best way to convert a date string say '2017-07-07 12:00:11' which is in GMT to say, IST by giving the offset '+5:30', so the date time changes to '2017-07-07 17:30:11'.
I did following but it did not work:
npm install moment-timezone
In the ts file:
import * as moment from 'moment-timezone';
let setdate = moment(); // today date
console.log('timezone date=', setdate);
setdate.tz("GMT").format('YYYY-MM-DD HH:mm:ss');
console.log(setdate.tz("Asia/Singapore").format('YYYY-MM-DD HH:mm:ss'));
But when i create the build, i get following error:
Module parse failed: blah\node_modules\moment-timezone\data\packed\l
atest.json Unexpected token (2:10)
Will this work in angular 2 or any other way exists to do this??