We sacrifice by not doing any other technology, so that you get the best of Magento.

We sacrifice by not doing any other technology, so that you get the best of Magento.

    Please find the Timezone.php file in the vendor directory.

    vendor/magento/framework/Stdlib/DateTime/Timezone.php

    you can find the scopeDate function in that file.

    Replace the below code

    public function scopeDate($scope = null, $date = null, $includeTime = false)
    {
        $timezone = new DateTimeZone(
            $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope)
        );
        switch (true) {
            case (empty($date)):
                $date = new DateTime('now', $timezone);
                break;
            case ($date instanceof DateTime):
            case ($date instanceof DateTimeImmutable):
                $date = $date->setTimezone($timezone);
                break;
            case (!is_numeric($date)):
                $timeType = $includeTime ? IntlDateFormatter::SHORT : IntlDateFormatter::NONE;
                $formatter = new IntlDateFormatter(
                    $this->_localeResolver->getLocale(),
                    IntlDateFormatter::SHORT,
                    $timeType,
                    $timezone
                );
                $timestamp = $formatter->parse($date);
                $date = $timestamp
                    ? (new DateTime('@' . $timestamp))->setTimezone($timezone)
                    : new DateTime($date, $timezone);
                break;
            case (is_numeric($date)):
                $date = new DateTime('@' . $date);
                $date = $date->setTimezone($timezone);
                break;
            default:
                $date = new DateTime($date, $timezone);
                break;
        }
    
        if (!$includeTime) {
            $date->setTime(0, 0, 0);
        }
    
        return $date;
    }

    with the below code

    public function scopeDate($scope = null, $date = null, $includeTime = false)
    {
        $timezone = new DateTimeZone(
            $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope)
        );
        switch (true) {
            case (empty($date)):
                $date = new DateTime('now', $timezone);
                break;
            case ($date instanceof DateTime):
            case ($date instanceof DateTimeImmutable):
                $date = $date->setTimezone($timezone);
                break;
            default:
                $date = new DateTime(is_numeric($date) ? '@' . $date : $date);
                $date->setTimezone($timezone);
                break;
        }
    
        if (!$includeTime) {
            $date->setTime(0, 0, 0);
        }
    
        return $date;
    }

     

    field_5bfb909c5ccae

      Get a Free Quote