jamesmills / laravel-timezone

Enable user Timezones in your application.
MIT License
677 stars 91 forks source link

Formatting dates #81

Open quevlu opened 2 years ago

quevlu commented 2 years ago

Hello, is it possible to get the format date for each country ? I'm not sure if the APIs return information connected to date format each country.

jamesmills commented 2 years ago

Interesting question. I'd have to spend some time on google.

quevlu commented 2 years ago

@jamesmills Hi, I've found a php class to handle different format dates:

https://www.php.net/manual/en/class.intldateformatter.php

quevlu commented 2 years ago

I'll work on it and submit a Pr. Let me work on it

quevlu commented 2 years ago

https://stackoverflow.com/questions/44387956/php-get-current-locale-using-timezone

I could very well be an English speaking American visiting Japan, thus my time zone would be Asia/Tokyo even though my local would still be en-US.

seabasss commented 2 years ago

Valid point, but it would be great as a default. A member signs up and it detects timezone and date/format and you can change both from there. This would be a great feature!

quevlu commented 2 years ago

I was thinking if you get the language from the user it would be a possibility to do it

quevlu commented 2 years ago

https://www.w3.org/International/questions/qa-date-format.en#:~:text=Opci%C3%B3n%20uno%3A%20usar%20un%20formato,%2C%202003%2Dabr%2D02.

I've been using this format "Y/M/d g:i a" and the result is 2022/Mar/06 7:10 pm