I am using ReactJS with NextJS and i receive some data from the API. This variables look alike with what i receive from api.
const timeStampOne = 2022-06-27T18:59:33.410430Z;
const timeStampTwo = 2021-02-11T09:36:05Z;
const dateConverter = () => {
const activityDate = format(
new Date(timeStampOne),
"yyyy-MM-dd H:mm:ss"
);
setActivityDateDetails(activityDate);
}
Wanted Input: 2021-02-11 09:36:05
Received Input: 2021-02-11 11:36:05
If i do it with timeStampTwo:
WantedInput: 2022-06-27 18:59:33
ReceivedInput: 2022-06-27 21:59:33
Why is this happening ? As far as i noticed, especially on the second timeStamp, this is how it is: YYYY-MM-DD/T/HH-MM-SS-MS-MS-MS-Z (MS as miliseconds, Z as Timezone, but before the Z i encounter 3 other numbers. How can i ignore the timezone in this case? I think this is what i want.
i also tried using the parse and parseIso method but it doesn't do the trick. And yes it is mandatory to use this library...