dimanche 4 février 2018

diffForHumans does not work returns me The separation symbol could not Carbon

I have a field in my MySQL table fecha as datetime, to which I want to apply the appropriate format and then get the difference using diffForHumans but it shows me error

"message": "The separation symbol could not be found\r\nThe separation symbol could not be found\r\nData missing", "exception": "InvalidArgumentException", "file": "C:\laragon\www\appcolegio\vendor\nesbot\carbon\src\Carbon\Carbon.php", "line": 582,

I have this in my class Visita

public function getFechaAttribute($value)
{

    return Carbon::createFromFormat('d/m/Y H:i:s',strtotime($value))
        ->timezone('America/Lima');
}

public function getDiffAttribute()
{
    $fx = $this->fecha;
    return Carbon::createFromFormat('d/m/Y H:i:s',strtotime($fx))
            ->timezone('America/Lima')
            ->diffForHumans();
}

In my view I want to show these two values, on the one hand the current date with the corresponding timezone and on the other the difference with the corresponding timezone

How can I achieve it? Use Laravel 5.5



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire