2

it seems that results from Ext.Date.localToUtc and Ext.Date.utcToLocal must be inverted.

var localTime = new Date(); // ROMANIA
var londonTime = Ext.Date.localToUtc(localTime);
console.log('Initial:', localTime);
console.log('London :', londonTime);
console.log('MyTime :', Ext.Date.utcToLocal(londonTime));
console.log('UTC!   :', Ext.Date.format(localTime, 'C'));

results for Romania Time zone (GMT+2):

Initial: Thu Jan 23 2020 17:48:09 GMT+0200 (Eastern European Standard Time)
London : Thu Jan 23 2020 19:48:09 GMT+0200 (Eastern European Standard Time)
MyTime : Thu Jan 23 2020 17:48:09 GMT+0200 (Eastern European Standard Time)
UTC!   : 2020-01-23T15:48:09.656Z

any thoughts?

matei.nick
  • 161
  • 1
  • 5
  • I didn't quite catch what's wrong with the results.. – scebotari66 Mar 06 '20 at 12:23
  • 1
    when in Romania is 17:48 in UK is -2h => 15:48 not 19:48:09. so if i change my time in utc (localToUtc it should give me -2h not +2h). meaning it should work as Ext.Date.format(localTime, 'C') does. Only that result seems to be correct. – matei.nick Mar 13 '20 at 22:02

0 Answers0