post by nasrul on Oct 27, 2023

hello @johnny

I noticed in the new version of Grocery CRUD that the date format settings have been removed. Is there another way to format dates in tables and input forms after this setting has been removed?

Regards
Nasrul

post by ajuser on Nov 2, 2023

post by johnny on Nov 3, 2023

Hello @nasrul ,

Unfortunately the current way is that it uses the browser date formatting. We have removed the hardcoded one since it was causing bugs in different browsers (more specifically Safari on mobile).

What is the issue that you have? Also as @ajuser said, maybe by using native_date will resolve the issue that you have?

In order to do that use fieldType. For example:

$crud->fieldType(‘my_field’, ‘native_date’);

Regards
Johnny

post by dodo.selusin on Nov 10, 2023

hello @nasrul

$crud->callbackColumn('tanggal_pembelian', function ($value, $row) {
            if (!empty($value)) return convertYmdToDmy($row->tanggal_pembelian);
        });

my helper function ::

if (! function_exists('convertYmdToDmy')) {
    function convertYmdToDmy($date)
    {
        return Carbon::createFromFormat('Y-m-d', $date)->format('d-m-Y');
    }
}

hope this help

regards,
dodo

1 / 4
Oct 2023