seshac / otp-generator

Laravel OTP Generator, SImple package to generate and send OTPs
MIT License
43 stars 22 forks source link

Timezone format in expiredAt #14

Open deyan-ardi opened 1 year ago

deyan-ardi commented 1 year ago

My timezone format in expiredAt token in hosting can't same with my configuration timezone, how to fix it?

deyan-ardi commented 1 year ago

I want checking expired token in hosting, so i create 2 variabel, (1) $expired, (2) $datetime_now

When i make $expired = OTP::expiredAt($identifier) in hosting, return datetime with timezone Asia/Jakarta (same with my hosting).

When i make $datetime_now using Carbon in hosting, return datetime with timezone (Asia/Makassar) (same with my location)

When i check if token expired, using if condition like that

If($datetime_now > $expired) { Return "token expired"; }

Always return true because my timezone is not same, so how to change timezone in OTP::expiredAt??

marzxxx90 commented 1 year ago

my web app carbon date not the same in vendor carbon seshac/otp-generator

marzxxx90 commented 1 year ago

Screenshot 2023-02-11 111041

deyan-ardi commented 1 year ago

Same problem, in my case, i replace manually column to fix Carbon date

marzxxx90 commented 1 year ago

I also manually update the column to fix the problem