I have two inputs of time and I want to get the difference/time-interval between these two using dayjs
How to get the correct formatted value for my Timezone using DayJS? Tried feeding the ISO string to the DayJS constructor and expected it'll parse it to the current timezone. But the output value is 30 minutes behind.
DayJS: Format and Convert an ISO Date/Time String to Local Timezone's ...
dayjs ('2022-11-30T21:00:00.000Z') and it gives me 2022-12-01T00:00:00+03:00.So the real date that was stored was 30th November, but it gives me 1st December. I saw this post dayjs returns wrong date with format in Stack overflow but the accepted solution is wired because it assumes that I manually remove the Z at the end.
dayjs format method returns one day off and gives me a wrong date
It turned out, Vars.date was not a dayjs object, as you guys mentioned. I guessed the Vars.date = dayjs (whatever) returns a dayjs object, but it seems not. using dayjs method on that solved the problem. I wanna accept an answer, please post it and will accept it. thanks
Yes! You can disable converting to local timezone in dayjs by passing in the original timezone as an additional argument in the dayjs constructor. Example:
How do I set a custom time zone with MUI X Date Picker and dayjs?