I am attempting to pass some date values from angular into Laravel using a GET
request. I dont believe these frameworks are related specifically to this problem however.
I pass the following value from a text
input field to my API 1/4/2017
.It is exactly this value. I need to use a text field because of a Angular JS plugin I am using to pick the date.
In my PHP API I have the following.
$data = json_decode($requestData->data, false);
$date_object = new DateTime;
if($data->primary_reports_from_date == '1/4/2017') {
print_r('identical');
} else {
print_r('not identical');
}
die;
In Firefox and Chrome I get identical
as my response, in IE I get not identical
..
Edit: ,. after u_mulder's comment I did a var_dump()
I got "string(23) "1/4/2017" for $data->primary_reports_from_date
and "string(8) "1/4/2017" for 1/4/2017
.
I have tried
print_r($data->primary_reports_from_date.' | 1/4/2017');die;
And I am getting "1/4/2017 | 1/4/2017" in my response
I have also tried
trim($data->primary_reports_from_date)
and stripslashes($data->primary_reports_from_date)
but no matter what I do when the data comes from IE I cannot seem to match it up.
Am I missing something obvious with GET requests and how the data might be affected?
The issue I have is I am trying to use DateTime::createFromFormat()
but it wont work when the data comes from IE, it just returns blank.