src/Domain/Value/DateTime/Date.php
public static function now(?string $timezone = null): Date
    {
        $timezone = $timezone ?: date_default_timezone_get();
        assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));

        $dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
        $year = (int) $dateTime->format('Y');
        $month = (int) $dateTime->format('n');
        $day = (int) $dateTime->format('j');

        return new static($year, $month, $day);
    }
public static function now(?string $timezone = null): Date
    {
        $timezone = $timezone ?: date_default_timezone_get();
        assert(Validate::isTimezone($timezone), sprintf('Invalid timezone: %s', $timezone));

        $dateTime = new DateTimeImmutable('now', new DateTimeZone($timezone));
        $year = (int) $dateTime->format('Y');
        $month = (int) $dateTime->format('n');
        $day = (int) $dateTime->format('j');

        return new static($year, $month, $day);
    }
public static function now ( ? string $ timezone = null ) : Date { $ timezone = $ timezone ? : date_default_timezone_get ( ) ; assert ( Validate :: isTimezone ( $ timezone ) , sprintf ( 'Invalid timezone: %s' , $ timezone ) ) ; $ dateTime = new DateTimeImmutable ( 'now' , new DateTimeZone ( $ timezone ) ) ; $ year = ( int ) $ dateTime -> format ( 'Y' ) ; $ month = ( int ) $ dateTime -> format ( 'n' ) ; $ day = ( int ) $ dateTime -> format ( 'j' ) ; return new static ( $ year , $ month , $ day ) ; }
Creates instance for the current date

@param string|null $timezone The timezone string or null for default

@return Date
Creates instance for the current date