• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Date + Formatter + Text Field Strangeness
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Date + Formatter + Text Field Strangeness


  • Subject: Re: Date + Formatter + Text Field Strangeness
  • From: Matt Neuburg <email@hidden>
  • Date: Sun, 03 Dec 2006 12:15:52 -0800
  • Thread-topic: Date + Formatter + Text Field Strangeness

On Sat, 2 Dec 2006 17:05:55 -0500, "I. Savant" <email@hidden>
said:
>List:
>
>   I have an application that keeps track of things based on a
>reference date. For various reasons (one of which has to do with the
>selected time scale - years, months, days, or time; another is that
>the NSDatePicker control doesn't work right in 10.4 for my purposes),
>the editor represents the date with several text fields, one for each
>component.
>
>   For example, I have a field for Year, one for Month, one for Day,
>and one for Time (in hours, minutes, and seconds). All these text
>fields use date formatters to display only their component of the
>date and all are bound to the document's referenceDate key.
>
>   The problem is that:
>
>- When I set the month, then the day, the month changes.

Things to think about, I guess:

(1) What happens to the underlying date?

(2) You say you're doing this through date formatters. So when you change
the day, the string representing the day is being converted to some object
value. What is that conversion? It sounds to me like that's the problem -
the string to object conversion is not doing what you expect.

(3) You are both using an formatter and binding. Why not use a transformer
for each field's binding so that you are in complete charge of the
relationship between the string in the field and the underlying date in the
model?

m.

--
matt neuburg, phd = email@hidden, <http://www.tidbits.com/matt/>
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
<http://www.amazon.com/gp/product/0596102119>



_______________________________________________

Cocoa-dev mailing list (email@hidden)

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

  • Follow-Ups:
    • Re: Date + Formatter + Text Field Strangeness
      • From: "I. Savant" <email@hidden>
  • Prev by Date: Re: Trouble Writing to File With NSFileHandle
  • Next by Date: Re: nscombobox and nextkeyview
  • Previous by thread: Re: Date + Formatter + Text Field Strangeness
  • Next by thread: Re: Date + Formatter + Text Field Strangeness
  • Index(es):
    • Date
    • Thread