3
I receive the service date as follows:
2020-11-05T06:15:00.000-03:00
To display to the user we use the library Moment.
Example:
import React from 'react';
import moment from 'moment';
var chegada = '2020-11-05T06:15:00.000-03:00';
console.log('--> data: ' + chegada);
console.log('--> data (moment):' + moment(chegada).format('DD/MM/YYYY HH:mm'));
My problem is that it takes into consideration the Timezone smartphone.
Changing the Timezone to -04:00 I have the following result:
Exit
LOG --> data: 2020-11-05T06:15:00.000-03:00
LOG --> data (moment):05/11/2020 05:15
How do I take into account the Timezone informed on the date, and not the smartphone?
@hkotsubo is a good answer, but I think he wants to know how to do it using the momentjs and not pure Javascript.
– Cmte Cardeal
Thiago test my answer see if in React-Native is equal to the last date please?
– novic
@Cmtecardeal If you read the answer you have in the duplicate I suggested, you will see that there also has a solution option with Moment.js, and that - from what I understand - serves for the case in question (
moment.parseZone
)– hkotsubo
@hkotsubo really has ... we just need to know if the device will work but, ta certinho.
– novic
@hkotsubo, yes! responds perfectly!
– Thiago Luiz Domacoski
In fact @novic also gave a simple solution and with the same result as the suggested question! Thank You All!
– Thiago Luiz Domacoski