• 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
NSDateFormatter not validating input
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDateFormatter not validating input


  • Subject: NSDateFormatter not validating input
  • From: David Alter <email@hidden>
  • Date: Tue, 29 Jun 2004 13:16:46 -0700

I'm having some problems with NSDateFormatter filtering dates correctly
on input. I have NSTextField that I have set the formatter to an
NSDateFormatter. Seeing how I want to use this for data input I have
not been very impressed with the NSDateFormatters ability to validate
input. For example if I enter 33/44/9999 it happily converts that to
5/3/92. Should I only use NSDateFormatter for out put. Any suggestion
on how to manage data input. Please keep in mind I will need to support
multiple languages and the differences in dates associated with that.

Here is what I'm doing
NSUserDefaults *the_UserDefaults = [NSUserDefaults
standardUserDefaults];
NSDictionary *the_DefaultsDictionary = [the_UserDefaults
dictionaryRepresentation];
NSDateFormatter *the_pDateFormatter = [[NUIDateFormatter alloc]
initWithDateFormat:[the_DefaultsDictionary objectForKey:
NSShortDateFormatString] allowNaturalLanguage: YES];
[mDate setFormatter: the_pDateFormatter];

thanks for the help
-dave
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: NSDateFormatter not validating input
      • From: Joakim Danielson <email@hidden>
    • NSTextViews with embedded pictures and vertical alignment
      • From: John Stiles <email@hidden>
  • Prev by Date: A (Hopefully) simple menu problem
  • Next by Date: NSTextViews with embedded pictures and vertical alignment
  • Previous by thread: Re: A (Hopefully) simple menu problem
  • Next by thread: NSTextViews with embedded pictures and vertical alignment
  • Index(es):
    • Date
    • Thread