Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Wrong Date/Time-Format in non-english environment (in Reservations_model.php) #30

Closed
git-gnulf opened this issue Jun 14, 2022 · 1 comment

Comments

@git-gnulf
Copy link

What happened?

In TI I changed the default language from english to german.
I reserve a table.
The system creates and sends to emails: one for the customer and one for the location
The emails arrives.
In both mails the date/time of the table reservation was included.
The date/time format in both emails are still in english format.
for example: Wednesday, 15. June 2022

What did you expect to happen?

If I set the default language to german, I expect the date/time format in the emails included are in german too.
For example: Mittwoch, 15. Juni 2022

Version

3.5.x

What browser are you seeing the problem on?

Firefox

Relevant log output

No response

@git-gnulf
Copy link
Author

What I do to fix this:
edit /app/admin/models/Reservations_model.php
change function mailGetData()
and here switch from method format() to method isoFormat().

public function mailGetData()
    {
        $model = $this->fresh();

        $data = $model->toArray();
        $data['reservation'] = $model;
        $data['reservation_number'] = $model->reservation_id;
        $data['reservation_id'] = $model->reservation_id;

        // REMOVE
        // $data['reservation_time'] = Carbon::createFromTimeString($model->reserve_time)->format(lang('system::lang.php.time_format'));
        // $data['reservation_date'] = $model->reserve_date->format(lang('system::lang.php.date_format_long'));

        // ADD
        $data['reservation_time'] = Carbon::createFromTimeString($model->reserve_time)->isoFormat(lang('system::lang.moment.time_format'));
        $data['reservation_date'] = $model->reserve_date->isoFormat(lang('system::lang.moment.date_format'));
   : 
   : 
}

sampoyigi added a commit to tastyigniter/ti-module-admin that referenced this issue Nov 5, 2022
fixes tastyigniter/ti-ext-reservation#30

Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant