-
Notifications
You must be signed in to change notification settings - Fork 194
Allow NSManagedObject formatter to be changed #46
base: master
Are you sure you want to change the base?
Conversation
* changed defaultFormatter to formatter * added a sharedFormatter getter * exposed setFormatter as public * added two tests to verify date formatting when using setFormatter
+ (void)setFormatter:(NSString *)newFormatter { | ||
[sharedFormatter setDateFormat:newFormatter]; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about name convenience?
- (void)setDateFormat:(NSString *)dateFormat {
[sharedFormatter setDateFormat:dateFormat];
}
* included podfile.lock * fixed call for setDateFormat when there is no sharedFormatter instance yet
Thanks @viking2009 I think it's much better now. |
@vnavarro thanks for your work! I do have a few concerns before merging this tho:
|
Hm, should it be by entity? I think a global setting actually works well here (as most APIs will use a global date format). For granularity we can fall back to the transformation support defined in #66. |
I've thought @kattrali said a certain API returns different date formats on a few places |
@supermarin In those cases, I think a transformation could solve the problem. An exception instead of a rule. |
@supermarin @stephencelis Agreed that transformation could handle those special cases. It seems reasonable to assume that different date formats per model would be the exception in most API synchronization flows. |
Sounds good. The last one - should we just expose the whole readonly |
@supermarin Hm, so maybe the date formatter should go directly on the CoreDataManager class? |
using setFormatter
Suggestion: Maybe is also a good idea to add some way of changing each date formatting while mapping.