Page MenuHomePhabricator

Birthday formatter code is an i18n nightmare
Open, Needs TriagePublicBUG REPORT

Description

The birthday formatting code that lives in the UserProfile class is a mess. The output format is hardcoded to F jS (no year) or F jS, Y (with year) - this produces output akin to "January 12th, 1930" regardless of the user's UI language or the site's content language.

To make matters a bit more nastier...

  1. No outside classes call formatBirthday (yay!), but...
  2. The output of getProfile uses that and said output is cached (without a cache time specified = resolving this bug requires modifying the cache key)

One of the many related gotchas is that SocialProfile allows users to not show the birth year, which is why the date stored in the DB as user_profile.up_birthday gets routed through UserProfile#formatBirthday.

The final formatting (presumably a call to $this->getContext()->getLanguage()->date( $appropriate_param_goes_here )) should happen in UserProfilePage#getPersonalInfo, much closer to the output; and not in UserProfile.