error when saving dates before 1901

SS4.2

This is a strange one. I am getting an error when entering a date before 1901. It is for a Date field. I noticed it when using the CSV import on the Members table. It is also happening when I edit the field manually.

private static $db = array(
	"DateJoined" 				=> "Date",
        "DateExpiry" 				=> "Date",
);
      
[2018-08-03 04:08:40] error-log.ERROR: Uncaught Exception InvalidArgumentException: "Invalid date: ''. Use y-MM-dd to prevent this error." at \vendor\silverstripe\framework\src\ORM\FieldType\DBDate.php line 41 {"exception":"[object] (InvalidArgumentException(code: 0): Invalid date: ''. Use y-MM-dd to prevent this error. at \\vendor\\silverstripe\\framework\\src\\ORM\\FieldType\\DBDate.php:41)"} 

Hi Jellygnite,

Please check your date format the error is look like something wrong in date format that you entered. Try * YYYY-MM-DD * this date format.

Hope this helps you.

Thanks!

Date is already in that format. It is only happening when the year is below 1901. Anything above this saves fine without error.

Links below may shed some light, could be a problem with strtotime. Possibly could be fixed in DateField or workaround by changing your PHP environment.