dimanche 28 août 2016

How to validate AM/PM on Laravel5?

I'm looking for validate 12 hours. A.M. 00:00 ~ 11:59 and P.M. 12:00 ~ 23:59.

Input value come like this.

<input type="text" name="am" value="00:00" />
<input type="text" name="am" value="11:59" />

<input type="text" name="pm" value="12:00" />
<input type="text" name="pm" value="23:59" />

So I made validate like this.

'am' => ['http://regex:/^(1[01]|0[0-9]):[0-5][0-9]$/'],
'pm' => ['http://regex:/^(2[0-3]|1[2-9]):[0-5][0-9]$/'],

Does Laravel have any good validation without regex? (like after:tomorrow) I don't wanna use regex that make code difficult to reading comprehension. Any Ideas?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire