Problem with Timezone when deploy Meteor App on DigitalOcean by MUP?


#1

I deploy my app on DigitalOcean by MUP.
I test on my local PC, It work fine. But it have problem with date when deploying.
My location is Asia/Phnom_Penh or Asia/Bangkok.
Please help me


#2

Did you check the timezone of your DO server ?

timedatectl status | grep "Time zone"

If it is not correct, you can reconfigure your server (if Ubuntu) with

sudo dpkg-reconfigure tzdata

It might be useful to use momentjs in your app if needed too to manage timezone.
Be also aware of the way you store dates in Collections, using this to have correct result with MongoDB queries

{ any_date_related_key: moment(your_date_to_save).toDate() }

#3

Thanks for your reply, I checked my hosting timezone

timedatectl status | grep "Time zone"

I got Time zone: Etc/UTC (UTC, +0000)
and then I try to change

root@localhost:~# timedatectl status | grep "Time zone"
       Time zone: Asia/Phnom_Penh (+07, +0700)

And use momentjs for any dateTime insert
Now I am testing again after correct Timezone
:blush:


#4

After I changed timezone on hosting server via sudo dpkg-reconfigure tzdata to Asia/Phnom_Penh.
And then I tried to create Meteor Method to get current timezone from Meteor Server

// Meteor method
return moment.tz.guess()

But I still get Etc/UTC