Jump to content


Photo

Datetime field for dates before 1970


  • Please log in to reply
2 replies to this topic

#1 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,521 posts
  • 845

  • LocationVihti, Finland

Posted 21 March 2012 - 06:01 AM

Currently datetime can only be used for dates which has unix timestamp 0 or above. I noticed this when tried to use datetime field as birthday-field.

I guess this would be pretty easy fix to allow pre-1970 dates also? Using signed integer field on database and allow negative values to be saved.

#2 ryan

ryan

    Hero Member

  • Administrators
  • 5,771 posts
  • 3108

  • LocationAtlanta, GA

Posted 21 March 2012 - 10:20 AM

Updated to support negative values in the timestamp, and committed. It had to do with validation rather than the DB field type. We're using a MySQL datetime field for storage, so that isn't bound to the limits of timestamps. We're using timestamps just on the PHP side for sortability, sanitization and abstraction from a defined date format.

#3 apeisa

apeisa

    Hero Member

  • Moderators
  • 2,521 posts
  • 845

  • LocationVihti, Finland

Posted 21 March 2012 - 10:41 AM

Great stuff, thanks Ryan!




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users