Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to set custom NSDateFormatter as the default Transformer #1753

Open
wolfsokta opened this issue Jan 16, 2014 · 1 comment
Open

Unable to set custom NSDateFormatter as the default Transformer #1753

wolfsokta opened this issue Jan 16, 2014 · 1 comment

Comments

@wolfsokta
Copy link

I'm unable to add a date formatter to the list of RKValueTransformers that is utilized when serializing dates because RKObjectMapping's initialize function always overrides it.

Basically in my apps didFinishLaunhcing I have the following code:

   // Update date format so that we can parse dates properly.
   // 2013-11-09 14:51:27 +0000
    NSDateFormatter *dateFormatter = [NSDateFormatter new];
    dateFormatter.dateFormat = @"yyyy-MM-dd HH:mm:ss Z";
    [[RKValueTransformer defaultValueTransformer] insertValueTransformer:dateFormatter atIndex:0];

Once I commented out the following line my NSDateFormatter was used.
https://github.com/RestKit/RestKit/blob/development/Code/ObjectMapping/RKObjectMapping.m#L140

Am I doing something incorrectly?

@psycotica0
Copy link

I'm also having this issue.
In my case I'm trying to get it to parse "2013-12-31" into local time instead of UTC.

The deprecated "addDefaultDateFormatterForString" worked, and adding an NSDateTransformer works as soon as I add it, but later on in the code, more things have been added to override it.

Not ideal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants