Hi David, Just as a note, the GNUstep code relies heavily on the ICU library.
What version of ICU are you using? Would it be possible to test against a different version of that library? I'm not trying to pass the bucket, but we just use the output of ICU as-is for these functions. On Wed, Mar 15, 2017 at 4:10 PM, Lobron, David <[email protected]> wrote: > Hi Niels (also also Stefan, who replied offline), > > I tried changing the order of the setters, but that did not appear to make > a difference. I also tried calling the setter methods instead of setting > the ivars: > > [dateFormatter setTimeStyle:NSDateFormatterMediumStyle]; > > rather than > > dateFormatter.timeStyle = NSDateFormatterMediumStyle; > > However, I'm still getting the incorrect format. The code in > NSDateFormatter seems fine to me, too (this is the 1.24.8 codeline). But I > still get: > > dateStr = 20010102 09:00 AM, refStr = Jan 2, 2001, 9:00:00 AM > > I will keep digging into it. > > Thank you for the help so far, > > David > > > On Mar 13, 2017, at 2:26 PM, Niels Grewe <[email protected]> > wrote: > > > > Hi David, > > > > just a small pointer wrt this: I vaguely recall having seen a similar > phenomenon in the past, where it turned out that our NSDateFormatter > implementation was sensitive to the order in which you called the setters. > I was under the impression that that problem had been fixed -- but maybe > there's a bug still hiding in there... > > > > Cheers, > > > > Niels > > > > Von: [email protected] > > Gesendet: 13. März 2017 4:33 nachm. > > An: [email protected] > > Betreff: NSDateFormatter issue > > > > Hi All, > > > > I've been working to get the NSDateFormatter class working with my > company's GNUStep version, which is based on GNUStep-1.24.8 for GNU/Linux. > I updated my build flags to signal that libicu should be used, and I > verified with print statements that NSDateFormatter's GS_USE_ICU variable > is set to true. > > > > However, when I try to format an NSDate object, I'm finding that > although the date is correct, the format never changes. My test code looks > like this: > > > > NSDateFormatter *dateFormatter = [[NSDateFormatter new] autorelease]; > > dateFormatter.dateStyle = NSDateFormatterMediumStyle; > > dateFormatter.timeStyle = NSDateFormatterMediumStyle; > > [dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]]; > > NSDate *date = [NSDate dateWithTimeIntervalSinceRefer > enceDate:118800]; > > dateFormatter.locale = [[NSLocale alloc] initWithLocaleIdentifier:@ > "en_US"]; > > NSString *dateStr = [dateFormatter stringFromDate:date]; > > NSString *refStr = @"Jan 2, 2001, 9:00:00 AM"; > > NSLog(@"dateStr = %@, refStr = %@", dateStr, refStr); > > > > But it prints the following: > > > > dateStr = 20010102 09:00 AM, refStr = Jan 2, 2001, 9:00:00 AM > > > > On a Mac, by contrast, dateStr has the correct format: > > > > 2017-03-13 11:30:03.081 testNsDateFormatter[6357:607704] dateStr = Jan > 2, 2001, 9:00:00 AM, refStr = Jan 2, 2001, 9:00:00 AM > > > > Does anyone know what might be causing this? If not, I will dig deeper > into NSDateFormatter and also check libicu. I tend to think libicu is not > the problem, because it runs a lot of internal tests on the udat_format > function, which is what NSDateFormatter is calling, and I've confirmed that > the format tests pass when run within libicu. > > > > Thanks, > > > > David > > > > > > > > _______________________________________________ > > 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 >
_______________________________________________ Discuss-gnustep mailing list [email protected] https://lists.gnu.org/mailman/listinfo/discuss-gnustep
