Welcome Guest, Not a member yet? Register   Sign In
CI4 validation greater_than on date field
#3

(This post was last modified: Today, 08:14 AM by pippuccio76.)

I create a custom rules:

Code:
<?php

namespace App\Validation;

class DateRules
{

    /**
    * Check if the first date is bigger than the second date.
    *
    * @param string $today oggi (Y-m-d format).
    * @param string $date_to_control data da controllare(Y-m-d format).
    * @return bool
    *
    */

    public function date_bigger_than_today(string $date_to_control)
    {

        $today = strtotime("now");
        $date_to_control = strtotime($date_to_control);

        if ($date_to_control > $today) {

            return true;

        } else {
           
            return false;
        }

    }

solved
Reply


Messages In This Thread
RE: CI4 validation greater_than on date field - by pippuccio76 - Today, 08:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB