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

Support Importing NSDate from Unix Timestamp #627

Closed
wants to merge 3 commits into
base: develop
from

Conversation

Projects
None yet
5 participants
@benrobjoh

benrobjoh commented Dec 29, 2013

I have added support for importing from JSON where dates are represented as Unix timestamps.

If a value that maps to an NSDate attribute in Core Data appears in the JSON as a string, the importing behavior is unchanged from before.

If the value appears in the JSON as a number and nothing is specified in the date attribute's userInfo for the key dateFormat, I assume the number represents the number of seconds since 1970 (10 digits). For JSON that represents its dates as the number of milliseconds since 1970 (13 digits), add the value unixTime13 for key dateFormat in the userInfo.

I have provided tests.

@ghost ghost assigned tonyarnold Dec 30, 2013

@JanC

This comment has been minimized.

JanC commented Jan 3, 2014

Hi,
that's what I need as well thanks!

Until the pull is accepted:

pod 'MagicalRecord',  :git => 'https://github.com/benrobjoh/MagicalRecord.git', :branch=>'unix-date'
@losingle

This comment has been minimized.

losingle commented Jan 5, 2014

+1

@aminebellakrid

This comment has been minimized.

aminebellakrid commented Mar 5, 2014

@tonyarnold will this pull request be merged soon ? if not is there a workaround. thanks

@JanC

This comment has been minimized.

JanC commented Mar 23, 2014

+1 will this ever be merged ?

@tonyarnold

This comment has been minimized.

Contributor

tonyarnold commented Mar 24, 2014

I'm so sorry guys — I intended to check all of this (and a few other date import PRs) over months ago, but I haven't had much time to work on MR lately. I'll check this out later tonight and merge the changes into the release/3.0 branch (assuming all the tests pass, etc).

@tonyarnold

This comment has been minimized.

Contributor

tonyarnold commented Mar 24, 2014

Quick update: Every single test in the 3.0 branch is broken. I'm fixing them this morning, then this. Bear with me.

tonyarnold added a commit that referenced this pull request Mar 25, 2014

@tonyarnold

This comment has been minimized.

Contributor

tonyarnold commented Apr 2, 2014

So I've merged this into MagicalRecord 3.0 — does anybody urgently need this in MagicalRecord 2.x? I wasn't planning on an MR 2.x release for a little while (at least until after MR 3 is finished).

@aminebellakrid

This comment has been minimized.

aminebellakrid commented Apr 2, 2014

@tonyarnold it would be life saving for me as it will allow me to do a work around for #700 . thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment