mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 19:51:09 -04:00
fix: Custom optional Date field issue
This commit is contained in:
@ -22,17 +22,26 @@ class CustomFieldValue extends Model
|
||||
|
||||
public function setDateAnswerAttribute($value)
|
||||
{
|
||||
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
|
||||
if ($value && $value != null) {
|
||||
$this->attributes['date_answer'] = Carbon::createFromFormat('Y-m-d', $value);
|
||||
}
|
||||
$this->attributes['date_answer'] = null;
|
||||
}
|
||||
|
||||
public function setTimeAnswerAttribute($value)
|
||||
{
|
||||
$this->attributes['time_answer'] = date("H:i:s", strtotime($value));
|
||||
if ($value && $value != null) {
|
||||
$this->attributes['time_answer'] = date("H:i:s", strtotime($value));
|
||||
}
|
||||
$this->attributes['time_answer'] = null;
|
||||
}
|
||||
|
||||
public function setDateTimeAnswerAttribute($value)
|
||||
{
|
||||
$this->attributes['date_time_answer'] = Carbon::createFromFormat('Y-m-d H:i', $value);
|
||||
if ($value && $value != null) {
|
||||
$this->attributes['date_time_answer'] = Carbon::createFromFormat('Y-m-d H:i', $value);
|
||||
}
|
||||
$this->attributes['time_answer'] = null;
|
||||
}
|
||||
|
||||
public function getDefaultAnswerAttribute()
|
||||
|
||||
Reference in New Issue
Block a user