The expiration date of eu domains always resets to current date.

Some basic information in json format and "Please visit www.eurid.eu for more info." in one field. I suppose that autodetect wont work, but when I try to change the date manually after adding the domain, it won't change the expiration date, that is my issue.

Hey, thanks for reporting.

This will be related to how the domain parsing works. Similar issue here.

I don't think we should set the date to today when it is not present in the response. It works on create because the function is executed before the user input is assigned, but in the edit it is the other way around. Design flaw imo.

if ($response) {

    if (is_array($response['expiration_date'])) {

        $expiry = new DateTime($response['expiration_date'][1]);

    }

    else {

        $expiry = new DateTime($response['expiration_date']);

    }

    return $expiry->format('Y-m-d');

}

Here you can see, that it hits the else branch and sets current date as expiration, because the response doesnt have that field.

Requested change could be to have

if ($response) {

        if (is_array($response['expiration_date'])) {

            $expiry = new DateTime($response['expiration_date'][1]);

        }

        elseif (isset($response['expiration_date'])) {

            $expiry = new DateTime($response['expiration_date']);

        }

        else {

            return null;

        }

        return $expiry->format('Y-m-d');

}

and then when type null is returned, expiration is not set or set to 'NULL' depending on edit/creation/cron

stehled

Thank you for raising this 🙂

I haven't had a chance to review personally, but your logic above is sound and I 100% agree.