discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDateFormatter SetDateStyle / setTimeStyle not working


From: Fred Kiefer
Subject: Re: NSDateFormatter SetDateStyle / setTimeStyle not working
Date: Fri, 25 Aug 2017 07:40:48 +0200

Hi Edwin,

could you please check whether this version of GNUstep was compiled with ICU 
support? The easiest way to do so is to print out the value of [format 
isLenient] next set it to a different value (if you get 0/NO set it to YES, if 
you get 1/YES set it to NO) [format setLenient: YES] and report the value 
again. If you still get the old value ICU isn’t used.

Hope this helps,
Fred

> Am 25.08.2017 um 06:38 schrieb Edwin Ancaer <eancaer@gmail.com>:
> 
> Hello, 
> 
> I hardly dare to suggest it, but I have got the impression that the methods 
> setDateStyle & setTimeStyle have no influence on the result of the method 
> stringFromDate, as you can see in the examples below.
> 
> Is it me, again not having understood the workings of these classes 
> completely, or is there really a problem?
> 
> I'm on FreeBSD 11.0, with gnustep installed from the ports. 
> 
> Examples: 
> 
>   NSDate* d = [NSDate date];   
>   NSLog(@"the date as date object             %@", d); 
>      
> 2017-08-25 06:20:32.673 TM1[1295:100101] the date as date object             
> 2017-08-25 06:20:32 +0200         
> 
> 
>   NSDateFormatter* format = [[NSDateFormatter alloc] init];
>   NSLog(@"Dateformatter defaults");
>   NSLog(@"  DateFormatter timezone: %@", [format timeZone]);
>   NSLog(@"  DateFormatter locale: %@", [format locale]);
>   NSLog(@"  DateFormatter datestyle: %u", [format dateStyle]);
>   NSLog(@"  DateFormatter timestyle: %u", [format timeStyle]);
>   NSLog(@"  Date formatted with defaults      %@", [format stringFromDate: 
> d]);
> 
> 2017-08-25 06:20:32.695 TM1[1295:100101] Dateformatter defaults
> 2017-08-25 06:20:32.703 TM1[1295:100101]   DateFormatter timezone: 
> Europe/Brussels
> 2017-08-25 06:20:32.711 TM1[1295:100101]   DateFormatter locale: nl_BE
> 2017-08-25 06:20:32.719 TM1[1295:100101]   DateFormatter datestyle: 0
> 2017-08-25 06:20:32.727 TM1[1295:100101]   DateFormatter timestyle: 0
> 2017-08-25 06:20:32.736 TM1[1295:100101]   Date formatted with defaults      
> 20170825 06:20 a.m.
> 
>   
>   [format setDateStyle: NSDateFormatterNoStyle];
>   [format setTimeStyle: NSDateFormatterMediumStyle]; 
>   NSLog(@"DateFormatter: Date -> NoStyle, Time -> MediumStyle");
>   NSLog(@"  DateFormatter timezone: %@", [format timeZone]);
>   NSLog(@"  DateFormatter locale: %@", [format locale]);
>   NSLog(@"  DateFormatter datestyle: %u", [format dateStyle]);
>   NSLog(@"  DateFormatter timestyle: %u", [format timeStyle]);
>   NSLog(@"  Date formatted with style         %@", [format stringFromDate: 
> d]);
>   
> 2017-08-25 06:20:32.745 TM1[1295:100101] DateFormatter: Date -> NoStyle, Time 
> -> MediumStyle
> 2017-08-25 06:20:32.754 TM1[1295:100101]   DateFormatter timezone: 
> Europe/Brussels
> 2017-08-25 06:20:32.763 TM1[1295:100101]   DateFormatter locale: nl_BE
> 2017-08-25 06:20:32.773 TM1[1295:100101]   DateFormatter datestyle: 0
> 2017-08-25 06:20:32.783 TM1[1295:100101]   DateFormatter timestyle: 2
> 2017-08-25 06:20:32.794 TM1[1295:100101]   Date formatted with style         
> 20170825 06:20 a.m.
> 
> 
>   [format setDateStyle: NSDateFormatterLongStyle];
>   [format setTimeStyle: NSDateFormatterLongStyle]; 
>   NSLog(@"DateFormatter: Date -> LongStyle, Time -> LongStyle");
>   NSLog(@"  DateFormatter timezone: %@", [format timeZone]);
>   NSLog(@"  DateFormatter locale: %@", [format locale]);
>   NSLog(@"  DateFormatter datestyle: %u", [format dateStyle]);
>   NSLog(@"  DateFormatter timestyle: %u", [format timeStyle]);
>   NSLog(@"  Date formatted with style         %@", [format stringFromDate: 
> d]);   
> 
> 2017-08-25 06:20:32.809 TM1[1295:100101] DateFormatter: Date -> LongStyle, 
> Time -> LongdiumStyle
> 2017-08-25 06:20:32.825 TM1[1295:100101]   DateFormatter timezone: 
> Europe/Brussels
> 2017-08-25 06:20:32.838 TM1[1295:100101]   DateFormatter locale: nl_BE
> 2017-08-25 06:20:32.853 TM1[1295:100101]   DateFormatter datestyle: 3
> 2017-08-25 06:20:32.867 TM1[1295:100101]   DateFormatter timestyle: 3
> 2017-08-25 06:20:32.881 TM1[1295:100101]   Date formatted with style         
> 20170825 06:20 a.m.
> 
> Could someone tell me what the problem is here?
> 
> Thanks, 
> 
> Edwin Ancaer
> _______________________________________________
> Discuss-gnustep mailing list
> Discuss-gnustep@gnu.org
> https://lists.gnu.org/mailman/listinfo/discuss-gnustep




reply via email to

[Prev in Thread] Current Thread [Next in Thread]