Hmm, that does seem stage. It should all be working. I'm sure the problem is not the FreeBSD source, David does a pretty good job keeping those updated.
I'll test it on my end a bit to try to figure it out. On Aug 26, 2017 00:46, "Edwin Ancaer" <[email protected]> wrote: > Fred, Stefan, > > Indeed, the instruction [format lenient] returns 1, independant of setting > the value with > [format setLenient: NO] and [format setLenient: YES]. > > I'm sure I saw libicu mentioned in the dependencies for gnustep, and given > the definition of isLenient in NSDatformatter.m and the fact that I got 1 > from isLenient, I supposed that GS_USE_ICU was 1: return NO resulting in > the value 1 seems illogical. > > - (BOOL) isLenient > { > #if GS_USE_ICU == 1 > return (BOOL)udat_isLenient (internal->_formatter); > #else > return NO; > #endif > } > > But thinking of it, this is the source from https://github.com/gnustep/ > libs-base/blob/master/Source/NSDateFormatter.m., I've got no idea were > FreeBSD is getting its sources. I will have to look into the freebsd ports > mechanism to find out, just to be sure. Or try the debugger, to see what > is really going on. > > Concerning the locale, the value for systemlocale is "en_US_posix", the > default locale is "nl_BE",and the locale returned from the NSDateFormatter > is also "nl_BE". But I admit, the returned values do not look correctly > formatted either. > > Again, maybe the debugger is the best way to find out what is going wrong. > > > Thanks for your anwers already, I'll see if I can find out more about > this. Or give up, and just use format strings.... > > Kind regards, > > Edwin > > 2017-08-25 15:21 GMT+02:00 Stefan Bidigaray <[email protected]>: > >> Based on your previous posts, it sounds like your current locale is >> en_US_POSIX. Can you verify that by checking the output of [NSDateFormatter >> -locale]? This locale outputs the same date string regardless of the style. >> >> You can set the formatter's locale with -setLocale: before any calls to >> -stringFromDate:. >> >> On Aug 25, 2017 00:38, "Edwin Ancaer" <[email protected]> wrote: >> >>> 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 >>> [email protected] >>> https://lists.gnu.org/mailman/listinfo/discuss-gnustep >>> >>> >
_______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
