0

How do I convert server's default timezone to the user's local time?

date(){
  const date = dayjs(this.status.date);//returns string with time server, for example 2021-02-26 05:40:29
  return date.hour() === 0 && date.minute() === 0 ? date.format('DD.MM.YYYY') : date.format('DD.MM.YYYY HH:mm');

}

1 Answers1

0

You can easily do that without using dayjs or additional library by using new Date(your date). It will automatically convert the date to user local timezone.