mirror of
https://github.com/inverse-inc/sogo.git
synced 2026-10-06 04:20:33 +00:00
Monotone-Parent: 3153e42cfafdd9f2a07623a78af07f4b4e837945
Monotone-Revision: 94cd3c2d69b764a47aa3032dde40735f50a696c9 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2010-01-06T19:21:15 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
@@ -21,11 +21,15 @@
|
||||
|
||||
#import <Foundation/NSValue.h>
|
||||
#import <Foundation/NSCalendarDate.h>
|
||||
#import <Foundation/NSTimeZone.h>
|
||||
|
||||
#import <NGObjWeb/WOContext.h>
|
||||
#import <NGObjWeb/WOContext+SoObjects.h>
|
||||
#import <NGObjWeb/WORequest.h>
|
||||
#import <NGExtensions/NSObject+Logs.h>
|
||||
|
||||
#import <SOGo/SOGoUser.h>
|
||||
#import <SOGo/SOGoUserDefaults.h>
|
||||
|
||||
#import "UIxDatePicker.h"
|
||||
|
||||
@implementation UIxDatePicker
|
||||
@@ -144,6 +148,9 @@
|
||||
{
|
||||
NSString *dateString;
|
||||
NSCalendarDate *d;
|
||||
NSInteger dateTZOffset, userTZOffset;
|
||||
NSTimeZone *userTZ;
|
||||
SOGoUserDefaults *ud;
|
||||
|
||||
dateString = [_rq formValueForKey:[self dateID]];
|
||||
if (dateString == nil) {
|
||||
@@ -158,6 +165,18 @@
|
||||
dateString];
|
||||
}
|
||||
|
||||
/* we must adjust the date timezone because "dateWithString:..." uses the
|
||||
system timezone, which can be different from the user's. */
|
||||
ud = [[_ctx activeUser] userDefaults];
|
||||
dateTZOffset = [[d timeZone] secondsFromGMT];
|
||||
userTZ = [ud timeZone];
|
||||
userTZOffset = [userTZ secondsFromGMT];
|
||||
if (dateTZOffset != userTZOffset)
|
||||
d = [d dateByAddingYears: 0 months: 0 days: 0
|
||||
hours: 0 minutes: 0
|
||||
seconds: (dateTZOffset - userTZOffset)];
|
||||
[d setTimeZone: userTZ];
|
||||
|
||||
[self setDay: [NSNumber numberWithInt:[d dayOfMonth]]];
|
||||
[self setMonth:[NSNumber numberWithInt:[d monthOfYear]]];
|
||||
[self setYear: [NSNumber numberWithInt:[d yearOfCommonEra]]];
|
||||
|
||||
Reference in New Issue
Block a user