Handle birthday dates before 1970
parent
9f7c205da9
commit
9e905b43ff
9
NEWS
9
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)
|
||||
------------------
|
||||
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -73,14 +73,14 @@
|
|||
</header>
|
||||
<section class="msg-body">
|
||||
|
||||
<div class="pseudo-input-container" ng-show="editor.card.$birthday().length">
|
||||
<div class="pseudo-input-container" ng-show="editor.card.birthday">
|
||||
<div class="key">
|
||||
<label class="pseudo-input-label">
|
||||
<var:string label:value="Birthday"/>
|
||||
</label>
|
||||
</div>
|
||||
<div class="pseudo-input-field">
|
||||
<span>{{editor.card.$birthday()}}</span>
|
||||
<span>{{editor.card.$birthday}}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue