Date field error in 1.2.9 and patch
After installing 1.2.9 we discovered that the date displayed in the birthday profile field was always off by 1 day. This is because the date is stored as a GMT Unix timestamp, but when it is retrieved for display it is converted to the local time.
Line 84 in bp-xprofile-filters.php calls bp_format_time(), which then adds the GMT offset before using date().
This appears to be fixed in 1.3 (1.5?) with an extra parameter to bp_format_time(), but if you would like to fix it in 1.2.9, just patch line 84 of bp-xprofile-filters.php.
From: $field_value = bp_format_time( $field_value, true );
To: $field_value = date( ‘F j, Y ‘, $field_value );
BTW (warning, nitpick ahead), if any BP devs are listening, that extra parameter to bp_format_time() in 1.3 (1.5?) is (in my humble opinion) overkill and misleading. A birthday date is not associated with a timezone. It doesn’t get localized on the way in to the db and there is no need to use a general helper on the way out. Much simpler and more readable to use date() on the way out.
- The topic ‘Date field error in 1.2.9 and patch’ is closed to new replies.