diff --git a/app/helpers/people_helper.rb b/app/helpers/people_helper.rb index 4711433ed27dbb3da57206af0ba1d34e02ca2007..03f5e47b85dcd4210b475e71d8ac4d5907181aad 100644 --- a/app/helpers/people_helper.rb +++ b/app/helpers/people_helper.rb @@ -19,4 +19,12 @@ module PeopleHelper I18n.t "people.helper.people_on_pod_are_aware_of" end end + + def birthday_format(bday) + if bday.year == 1000 + bday.strftime("%B %d") + else + bday.strftime("%B %d %Y") + end + end end diff --git a/app/models/profile.rb b/app/models/profile.rb index 2e66fc37e46267eba45312998cd043fe8741a9d3..12215928596a5d532efd3fc4039d64d3f29eded0 100644 --- a/app/models/profile.rb +++ b/app/models/profile.rb @@ -88,10 +88,11 @@ class Profile end def date= params - if ['year', 'month', 'day'].all? { |key| params[key].present? } + params['year'] = '1000' if params['year'].blank? + if ['month', 'day'].all? { |key| params[key].present? } date = Date.new(params['year'].to_i, params['month'].to_i, params['day'].to_i) self.birthday = date - elsif ['year', 'month', 'day'].all? { |key| params[key] == '' } + elsif ['month', 'day'].all? { |key| params[key].blank? } self.birthday = nil end end diff --git a/app/views/people/_profile_sidebar.html.haml b/app/views/people/_profile_sidebar.html.haml index 892d151461898a9878358813d47235c0a69c4833..716ec46816e7dba81c81690bb939fe3216c893e5 100644 --- a/app/views/people/_profile_sidebar.html.haml +++ b/app/views/people/_profile_sidebar.html.haml @@ -54,5 +54,4 @@ - unless person.profile.birthday.blank? %h3 =t('.born') - = t('ago', :time => time_ago_in_words(person.profile.birthday)) if @person.profile.birthday - + = birthday_format(person.profile.birthday) diff --git a/config/locales/diaspora/en.yml b/config/locales/diaspora/en.yml index a4a8996784cfc74c64a3b00ed56626126416e00b..f7306f50902d6e4bf4fc5cdebf2dc0deebcafdbd 100644 --- a/config/locales/diaspora/en.yml +++ b/config/locales/diaspora/en.yml @@ -366,7 +366,7 @@ en: edit_my_profile: "Edit my profile" bio: "bio" gender: "gender" - born: "born" + born: "birthday" in_aspects: "in aspects" cannot_remove: "Cannot remove %{name} from last aspect. (If you want to disconnect from this person you must remove contact.)" remove_from: "Remove %{name} from %{aspect}?"