1
Personal talk.
I’m having some trouble trying to use the momentjs library to work with dates.
My problem is described below.
****--------- Datetime ----------****
Timestamp recebido do banco de dados -> 2016-07-12 17:21:40 <- ESTA É A DATA 'UTC' QUE ESTA RETORNANDO DO BANCO COMO STRING
moment.tz(datetime, moment.tz.guess()); //datetime value is '2016-07-12 17:21:40' and moment.tz.guess() is returning "America/Sao_Paulo"
// inspect the moment object returned
q{ _isAMomentObject:true, _i:"2016-07-12 17:21:40", _f:"YYYY-MM-DD HH:mm:ss", _isUTC:true, _pf:Object…}
_a: Array[7]
_d:Tue Jul 12 2016 14:21:40GMT-0300 (BRT) <- ESTA É A DATA CORRETA QUE EU QUERO
_f:"YYYY-MM-DD HH:mm:ss"
_i:"2016-07-12 17:21:40"
_isAMomentObject:true
_isUTC:true
_isValid:true
_locale:B
_offset:-180
_pf:Object
_z:h
__proto__:Object
// moment object formatted .format('YYYY-MM-DD HH:mm:ss')
2016-07-12 17:21:40 <- ESSA É A DATA QUE ESTA RETORNANDO, E ESTA ERRADA
****-------------------****
Can anyone tell me why?
thanks. It worked.
– Erick Gallani