Skip to content

Conversation

@ctudorache87
Copy link

The date range field didn't work when the Laravel date mutators were not configured for the start and end date columns, in which case those dates were plain strings by default.

$formattedDate = null;
if (isset($entry) && !empty($entry->{$dateFieldName})) {
$dateField = $entry->{$dateFieldName};
if ($dateField instanceof \Carbon\Carbon || $dateField instanceof \Jenssegers\Date\Date) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should attempt to just "duck type" this (i.e. if it's an object that has the format method then call the format method).

Copy link
Member

@tabacitu tabacitu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@tabacitu tabacitu merged commit a4309cb into dev Oct 23, 2017
@tabacitu tabacitu removed the ready label Oct 23, 2017
@tabacitu
Copy link
Member

Thank you @tumf87 ! Tested, merged on dev!

@tabacitu tabacitu deleted the 831-fix-date-range-field branch October 23, 2017 11:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants