خرید بک لینک

Vote count: 0

I have a form, and a user have to enter a date of begiing and a date of ending.

I'm using the compare attribute inside the rules method because the user can't enter a date of ending which is before the date of begiing.

Here's my rules method inside the form's model :

['dateFinTR', 'date', 'format' => 'php: d/m/Y'],
['dateFinTR', 'compare', 'compareAttribute' => 'dateDebutTR', 'operator' => '>=', 'skipOnEmpty' => true,]

The problem is if a user enter a date of begiing as 2016-05-18 and a date of ending of 2016-04-17, an error message is shown and the user can't submit the form. But if the user enter a date of begiing of 2016-05-18 and a date of ending of 2016-04-23 there is no error and the user can't submit the form. In fact only the day is compared with this rule.

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: چهارشنبه 29 ارديبهشت 1395 ساعت: 14:20

صفحه بندی