针对特定格式的laravel中的格式验证

I am trying to get date_format validation going on in my laravel application. Its an api and get datetime in the format

2015-10-09T12:36:576+01:00

It is supposed to be IOS 8601 format so I was checking it against the format "Y-m-d\TH:i:sO" by using

'createdAt'  => "required|date_format:Y-m-d\TH:i:sO",

But the validation fails. I am pretty sure that I am wrong in the format for the date(which I got from the official php documentation meaning the format for the data is not ISO 8601). Could someone please tell me what format that date is in?

Thanks

Your date format ends with +01:00. You are trying to match with type O which is +0100 (without the colon)

See the format specs here.

http://php.net/manual/en/function.date.php

What's kind of messed up is in laravel, it creates a date object which is able to accurately read your date, but then it tries to render it back to the format you specified (removing the :) and then comparing it to the original, which is obviously different:

https://github.com/laravel/framework/blob/5.4/src/Illuminate/Validation/Concerns/ValidatesAttributes.php#L363

This is a problem because technically both of those formats are ISO 8601 compliant.