Skip to:

Date field error in 1.2.9 and patch

  • Profile photo of Greg


    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Profile photo of Paul Gibbs
    Paul Gibbs


    We always listen.

    The problem *was* down to localisation of time zones. The change went in on ticket — have a read through, and the associated forum topic.

    Profile photo of Greg


    Thanks for listening. :-) And thanks for adding the link. My comment at the end was about that change.

    Just so its clear for everyone else, although the change went in in January, this fix was not in 1.2.9.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Date field error in 1.2.9 and patch’ is closed to new replies.
Skip to toolbar