Re: NSDatePicker updates its values on changing System's time zone
Re: NSDatePicker updates its values on changing System's time zone
- Subject: Re: NSDatePicker updates its values on changing System's time zone
- From: Mike Abdullah <email@hidden>
- Date: Thu, 26 Nov 2009 16:01:01 +0000
NSDatePicker takes an NSDate as its value. When you change the system timezone, that value does not change. It is still the same NSDate with the same value describing the same point in time.
But because the system timezone has changed, the formatted string equivalent has changed to match. So your choice is: how do you want to handle the timezone change?
A) Generate a new NSDate instance that once formatted gives the appearance of the formatted string not having changed.
To do this you'll need to pick up on the notification of system timezone change and then adjust all such dates yourself
B) Ignore the change of system timezone for your date picker. Thus the date when formatted will continue to look the same.
This should be pretty easy. When creating the date picker, assign it a timezone to use rather than accepting the default.
On 26 Nov 2009, at 15:15, Arun wrote:
> Hi All,
> In my application i use a NSDatePicker with stepper to display hours and
> minutes.
> When i change the Timezone of the system in System Preferences, the value in
> the Date Picker changes.
> How can we prevent change of value in the Date picker when system time zone
> changes?
>
> Thanks
> Arun KA
> _______________________________________________
>
> Cocoa-dev mailing list (email@hidden)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
>
> This email sent to email@hidden
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden