-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Dates #58
Comments
Thanks for the suggestions!
|
Reported-by: #58 Signed-off-by: Stephen Celis <stephen@stephencelis.com>
Thanks for taking the time to respond. I'll respectfully agree to disagree on the decision to not including some timezone designation, but I certainly understand and appreciate your rationale. Best wishes. |
I'm not sure if you mean to come across as argumentative. As I mentioned, the decision is not closed and the format you suggested may come back in a future commit. If you use SQLite.swift in a future project and have any more comments/suggestions, please send them my way. |
In your documentation, you suggest the following
NSDateFormatter
:I'd make a few suggestions:
I'd suggest you also set the
locale
of theNSDateFormatter
toNSLocale(localeIdentifier: "en_US_POSIX")
in order to ensure that you don't have problems with users/developers using non-Gregorian calendars. See Technical Q&A 1480.I'd also suggest including the time zone in the string. If you want to handle it like
NSLog
, you could write it with nice human readable+0000
. Or if you want to conform to ISO8601/RFC3339 standards, you'd put aT
between the date and the time and append aZ
at the end to designate that it's "Zulu".Personally, I'd also have the default behavior to include milliseconds (
SSS
in the format string, too), and perhaps adopt the ISO 8601 style, e.g.yyyy-MM-dd'T'HH:mm:ss.SSS'Z'
).It's up to you, but rather than proper date handling being a comment in the documentation, and leaving it to the developer to implement it correctly (and, as evidenced by Stack Overflow, most of them won't), I might suggest incorporating it right into the class, so that, by default, the app developer has a good solid handling of
NSDate
parameters. Maybe make theNSDateFormatter
property that the library uses a read/write property that the developer can override with whatever they want. But default it to some well-established best practice, perhaps something like what we've outlined above.The text was updated successfully, but these errors were encountered: