79269429

Date: 2024-12-10 18:59:38
Score: 2.5
Natty:
Report link

I found a way to (essentially) do this. I am having trouble with the Japanese calendar as of iOS 18.1 and I needed a similar solution. While we can't change what happens with [NSCalendar currentCalendar], I found a way to simply not use it. I made an NSCalendar category and added this:

+ (NSCalendar *)adjustedCalendar {
    
    NSCalendar *cal = [NSCalendar currentCalendar];
    
    if (cal.calendarIdentifier == NSCalendarIdentifierJapanese) {
        cal = [[NSCalendar alloc] initWithCalendarIdentifier:NSCalendarIdentifierGregorian];
    }
    
    return cal;
}

Instead of calling currentCalendar, I call adjustedCalendar and it always gives me a Gregorian one.

Reasons:
  • Blacklisted phrase (0.5): I need
  • RegEx Blacklisted phrase (2): I am having trouble
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Low reputation (1):
Posted by: userMJ