Make WordPress Core


Ignore:
Timestamp:
09/17/2024 11:22:43 PM (21 months ago)
Author:
kadamwhite
Message:

REST API: Allow posts to be published with a publication date of midnight 1970-01-01.

Explicitly checks date parsing return values for false, so that 0 (the value returned for the UNIX epoch of 1970-01-01 00:00:00) is correctly treated as a valid timestamp.

It should be valid to create a post dated to any point in history.

Props emmanuel78, sabernhardt, siliconforks, drjosh07, antpb, TimothyBlynJacobs.
Fixes #60184.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-schema-validation.php

    r55457 r59040  
    10191019        $this->assertWPError( $error );
    10201020        $this->assertSame( 'Invalid date.', $error->get_error_message() );
     1021    }
     1022
     1023    /**
     1024     * @ticket 60184
     1025     */
     1026    public function test_epoch() {
     1027        $schema = array(
     1028            'type'   => 'string',
     1029            'format' => 'date-time',
     1030        );
     1031        $this->assertTrue( rest_validate_value_from_schema( '1970-01-01T00:00:00Z', $schema ) );
    10211032    }
    10221033
Note: See TracChangeset for help on using the changeset viewer.