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

to_carbon helper alternateFormat issue. #26

Open
cmoses1020 opened this issue Apr 28, 2020 · 0 comments
Open

to_carbon helper alternateFormat issue. #26

cmoses1020 opened this issue Apr 28, 2020 · 0 comments

Comments

@cmoses1020
Copy link

cmoses1020 commented Apr 28, 2020

$alternateFormat in to_carbon helper is used too late in the method and will sometimes be missed completely.

The date format m/d/Y comes out wrong when being passed to to_carbon because of this

to_carbon('06/02/2000', 'm/d/Y')->format('m/d/Y');
// outputs 02/06/2000

$value is caught by line 947

// Try to convert it using strtotime().
if (($date = strtotime($value)) !== false)
{
	return Carbon\Carbon::createFromTimestamp($date);
}

If $alternateFormat is used i believe createFromFormat() should come sooner in this method.

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