diff --git a/NEWS b/NEWS index 378a7eb5d..399d2cc27 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,12 @@ +3.0.2 (2016-02-DD) +------------------ + +Enhancements + - + +Bug fixes + - [web] handle birthday dates before 1970 + 3.0.1 (2016-02-05) ------------------ diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index e01d6ca39..dd9212c85 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -349,7 +349,8 @@ static Class SOGoContactGCSEntryK = Nil; NSMutableArray *units, *categories; NSCalendarDate *date; id o; - unsigned int i, year, month, day, seconds; + int seconds; + unsigned int i, year, month, day; [card setNWithFamily: [attributes objectForKey: @"c_sn"] given: [attributes objectForKey: @"c_givenname"] @@ -365,7 +366,7 @@ static Class SOGoContactGCSEntryK = Nil; forKey: @""]; seconds = [[NSString stringWithFormat: @"%@", [attributes objectForKey: @"birthday"]] intValue]; - if (seconds > 0) + if (seconds != 0) { date = [NSCalendarDate dateWithTimeIntervalSince1970: seconds]; year = [date yearOfCommonEra]; diff --git a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox index 36ff7a71f..75cc90919 100644 --- a/UI/Templates/ContactsUI/UIxContactViewTemplate.wox +++ b/UI/Templates/ContactsUI/UIxContactViewTemplate.wox @@ -73,14 +73,14 @@
-
+
- {{editor.card.$birthday()}} + {{editor.card.$birthday}}
diff --git a/UI/WebServerResources/js/Contacts/Card.service.js b/UI/WebServerResources/js/Contacts/Card.service.js index a66293e1d..db34dfa56 100644 --- a/UI/WebServerResources/js/Contacts/Card.service.js +++ b/UI/WebServerResources/js/Contacts/Card.service.js @@ -42,7 +42,8 @@ angular.extend(Card, { $$resource: new Resource(Settings.activeUser('folderURL') + 'Contacts', Settings.activeUser()), $timeout: $timeout, - $gravatar: Gravatar + $gravatar: Gravatar, + $Preferences: Preferences }); // Initialize categories from user's defaults Preferences.ready().then(function() { @@ -170,6 +171,9 @@ this.$omit(), { action: action }) .then(function(data) { + // Format birthdate + if (_this.birthday) + _this.$birthday = Card.$Preferences.$mdDateLocaleProvider.formatDate(_this.birthday); // Make a copy of the data for an eventual reset _this.$shadowData = _this.$omit(true); return data; @@ -281,18 +285,6 @@ return fullname.join(' '); }; - /** - * @function $birthday - * @memberof Card.prototype - * @returns the formatted birthday object - */ - Card.prototype.$birthday = function() { - if (this.birthday) { - return [this.birthday.getFullYear(), this.birthday.getMonth() + 1, this.birthday.getDate()].join('/'); - } - return ''; - }; - Card.prototype.$isCard = function() { return this.c_component == 'vcard'; }; @@ -468,6 +460,7 @@ }); if (_this.birthday) { _this.birthday = new Date(_this.birthday * 1000); + _this.$birthday = Card.$Preferences.$mdDateLocaleProvider.formatDate(_this.birthday); } // Make a copy of the data for an eventual reset _this.$shadowData = _this.$omit(true);