Skip to content

Instantly share code, notes, and snippets.

@waldoj
Created June 3, 2013 16:22
Show Gist options
  • Select an option

  • Save waldoj/5699321 to your computer and use it in GitHub Desktop.

Select an option

Save waldoj/5699321 to your computer and use it in GitHub Desktop.
Actual code segment from ExpressionEngine, found within /expressionengine/expressionengine/libraries/Localize.php, in convert_human_date_to_gmt(). I tracked it down in an effort to fix the software's inability to store dates from prior to 1902 <http://ellislab.com/forums/viewthread/74033>, which they had blamed on everybody but themselves.
if ($year < 1902 OR $year > 2037)
{
return $this->EE->lang->line('date_outside_of_range');
}
@waldoj
Copy link
Copy Markdown
Author

waldoj commented Jun 5, 2013

I think that's pretty easily addressed by PHP's PHP_INT_SIZE constant, which exists for just this purpose:

if ( (PHP_INT_SIZE == 4) && ($year < 1902 OR $year > 2037) )
{
    return $this->EE->lang->line('date_outside_of_range');
}

That way, only folks on 32-bit environments are bound to the range, while the rest of us can have proper dates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment