octoberfa / oc-persian

OctoberCms Persian Support
MIT License
5 stars 2 forks source link

Date picker not work in version 2.0.4 #8

Closed shemekhe closed 5 years ago

shemekhe commented 5 years ago

Hello. I have installed this plugin on a new project, however, for some reason, the Persian date picker is not working correctly on backend forms. It used to work in version 2.0.1 but now It does not save dates correctly.

Edited on 28/1/2020: corrected the problem description.

shemekhe commented 5 years ago

Changing database DateTime fields to Timestamp doesn't work too. That weird behaviour still persists, If I save a date, for example, 1398/3/1, it changes to 1398/3/3 after save.

TheServat commented 5 years ago

hi are you add $dates property to your model? for example:

class YoutModel extends Model
{
...
    /**
     * The attributes that should be mutated to dates.
     *
     * @var array
     */
    protected $dates = ['ends_at', 'starts_at'];
...
}

if you have any problme please call me 09353141211

TheServat commented 5 years ago

reopen if not fixed

shemekhe commented 4 years ago

Hi, sorry if it takes this long

First of all, thank you for your help. I already had this line protected $dates = ['ends_at', 'starts_at']; added in my class, however, I have found the root cause for the issue. If you change the timezone in settings from Asia/Tehran to UTC-00 the problem will be gone.

I think it happens because the library does not care about user preferences and it will break the convert function within the library.