« first day (1065 days earlier)      last day (1091 days later) » 
00:00 - 20:0020:00 - 00:00

8:03 PM
HI room.
Max, what code sets your property to a non-nil value?
what method?
 
user457812
I think I just heard someone say flesh blimp and all I can think of is that part of I Have No Mouth and I Must Scream's game
 
"I Have No Mouth and I Must Scream's game"?
Oic. I didn't know there was a video game for that story.
 
@duncanc no method, its set after initialization
So I create the controller, set the property then push it on the navigation stack
For some reason, adding a subview in the init method makes viewDidLoad run before its pushed, and before the property i set
 
No method? That doesn't make sense. All iOS objectiveC code has to be invoked by some method.
 
Errr
Its called from a method, but not of that controller
 
8:12 PM
Sure. In order to add a subview, you have to reference self.view. That triggers the view controllers' view to load if it hasn't already.
 
QuestionViewController *questionViewController = [[QuestionViewController alloc] init];
questionViewController.question = question;
[self.navigationController pushViewController:questionViewController animated:YES];
This is in a method
I was adding a subview when init is called, and viewDidLoad of that controller was called before that next line
I fixed it now
 
Like I said, that's probably because you are invoking self.view, which forces the view to load at that moment.
 
I was
 
Bad idea to reference self.view in a VC's init method.
 
I did not know that view
 
8:14 PM
It would make viewDidLoad be called before init is complete, which is messed up.
 
Anyways, is MST only 1 hour ahead of PST?
 
YEs, I think so. Eastern, then central, then mountain, then pacific.
To quote the docs on `UIViewController`: "If you access this property (self.view) and its value is currently nil, the view controller automatically calls the loadView method and returns the resulting view.
"
 
So strange, I had MST as +2 hours and CST as +1 hour lol
Thank you Duncan, now I know
and should fix all of my objective-C apps lol
 
Huh. Markdown isn't working in SO chat any more.
I can't use inline code tags (`) or italics. What about bold?
That still works. Strange.
 
I need to support all time zones in my app
Anyways, do you have any apps that do time zone selection good?
 
8:19 PM
Why don't italics tags work.
What about inline code?
 
lol
 
WTF? Now it's working.
To quote the docs on UIViewController:
Is it "Text that is in quotes" maybe?
I'm confused.
 
lol don't worry about it!
We need to speak of Time zones
I can't find any good examples besides for clocks, but I'm not making a clock
 
brb...
 
Need to let users select any time zone, 1 app I found like mine has all of them, but its messy
Starts at -16 and goes to +16, so 33 options that means? or 32.. they have a lot
 
8:24 PM
There should only be 24 unique time zones?
 
¯_(ツ)_/¯ dunno, the app goes from -16 to +16
Im talking about the world BTW if that makes any difference, there is only 24 unique ones in the world?
I found a map that actually had 26
-11 to +11
oh wait, yup
they had -11 again and a -12
 
Sure. There are only 24 hours in a day, right?
Does NSCalendar let you get a localized list of time zones?
It does for things like days of the week, month names, etc.
 
:O Apple has 48
 
Oh wait. It's NSDatFormatter.
 
Time zones are confusing
Basically, this is what I need. I need to display to users a clean, clear list of time zones. I get my show times in EST format, and I want to display EST as +0 hours, that is the original
then I have to support every time zone off of that, but has to be easy for users and clean, I'm not listing 48 time zones
and just a number +1, +2 isn't very helpful
then I just use those offsets. so PST is +3, if a show airs at 8pm in EST, its 5 here, so offset by 3 hours so its 8 here as well
 
8:35 PM
So present a picker view with time zone names in it, where EST is at the center, and the other time zone names are above/below that.
 
I was thinking of that
 
Is this for the US only?
 
No
the app will be for anyone
 
English only?
 
for now
I don't have translators, nor money to pay
 
8:36 PM
Seems like there should be a way to get the localized names of the time zones.
 
Apple does
But they give me 48
"po NSTimeZone.abbreviationDictionary().count
48"
 
NSDateFormatter has a bunch of methods for getting names of months/weekdays/quarters.
So so through them and pick the names that makes sense
I see there is also an array knownTimeZoneNames
 
lol, knownTimeZoneNames gave me like over 100 results
 
Gack. I see that.
Looks like there are duplicate names for quite a few timezones.
 
Im looking at a list that says each country has a bunch, like france has 12 time zones?
Some of the TV apps like mine have like 1
like "France" is 1 time zone option, and UK is another
lol, ill show it in military time, they have a list of 26 time zones
 
8:42 PM
I see that there are duplicates for standard time and daylight savings time. EST and EDT, for example.
That makes sense then. 24 time zones, plus daylight/standard, = 48 total time zones.
 
Ya, thats another issue about my app. Dunno if I need to support daylight savings?
I think so-_-
god damnit
 
GMT is fixed, so daylight savings time changes the offset from GMT.
 
but then again, I don't know what Trakt does. Trakt could very well give me daylight offset times and the app would just work, I apply the time zone offset to EST of what they give me
 
Trakt is the site that gives you the TV schedule?
Does it currently give you times in EST, or EDT
 
EST
"All dates will be GMT and returned in the ISO 8601 format like 2014-09-01T09:10:11.000Z. Adjust accordingly in your app for the user's local timezone."
 
8:45 PM
Hmm. So you need to change the time to EDT when it's active.
 
Note from service
 
It gives you internet date strings?
There you go then.
 
What I do when I get the string
let dateFormatter = NSDateFormatter()
let enUSPOSIXLocale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.locale = enUSPOSIXLocale
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"

return dateFormatter.dateFromString(string)
 
And then you need to convert that date to the user's specified time zone
 
Yes, I do that as well for the time zones I support
 
8:47 PM
ER, display it at least.
 
func timeZoneCorrectedDate() -> NSDate {
let timeOffset = currentTimeZone.timeZoneOffset()
let newDate = self.copy() as! NSDate
return newDate.dateByAddingTimeInterval(timeOffset)
}
My time zone class
Im going to post on a gist :P
 
Not a good idea to change the NSDate. You should leave the dates alone. You should use the time zone to change the way it's displayed.
 
That is what I do
 
An NSDate is an instant in time anywhere in the world (recorded in GMT). You convert that instant in time to a local time zone so it means something.
return newDate.dateByAddingTimeInterval(timeOffset)
 
Yes
 
8:52 PM
That code is altering the value of the date, not changing it's display time zone. It's wrong.
 
airdateLabel.setText(episode.airDate.timeZoneCorrectedDate().timeString())
 
Create a date formatter that you use to display an NSDate. Set the time zone of that formatter before calling stringFromDate and it will do the right thing.
 
I use it to alter the date, and display THAT altered date, but its never stored
 
That's a bad, bad way to manage dates.
 
Only 1 kind of altered date is stored, and that is for notifications
 
8:54 PM
Much better to run the date through a formatter with a time zone set.
 
Its stored with the UILocalNotification, its the episode date altered by the time zone altered by the notification offset
 
@BrianS I do not mean the validation. If I enter (Safari) the mail and then click with the mause somewhere, the text-field is getting dark blue and I cannot see anything. So you should check, if the field looses focus and there is a mail entered, it should not change to that dark blue color.
 
Why is it bad?
Its stored with the UILocalNotification, its the episode date altered by the time zone altered by the notification offset
I do use a formatter.
func dateStringWithFormat(format: String) -> String {
let dateFormatter = NSDateFormatter()
dateFormatter.dateFormat = format

return dateFormatter.stringFromDate(self)
}
I change the date, then call this method on the data (its in an extension) and I get the format
in string
 
@BrianS Co-Founder as advantages and disadvantages. Well if you and the other understand each other all is fine, but if sometime in the future there some thing, you have a problem, because of company shares.
 
@duncanC but if you are saying keep the stored date, then just set the time zone of the formatter to get the string is faster (running) then ill do that? I just need a better way to manage and keep track of the time zones then
Ill make a test to try it
 
8:59 PM
Not faster, cleaner.
I doubt if there's a detectable difference in performance.
 
....
I need faster :P
Maybe not with dates, but there is other stuff in the app as well that I don't have as much control, on a 4S I need memory down as much as possible
 
Keep your date formatter around and reuse it. That will be more efficient.
Creating a date formatter every time does a lot of needless memory allocation.
 
Errrrrrrr that would go against the way the app is coded:P
E.G. In Swift, I have a bunch of NSDate extensions
Extensions can't add a variable though?
I would have to make it global and static
 
No they can't.
Or create a dateUtils class.
Anyway, I gotta go.
Time to feed my beasts.
 
:(
Thanks for the help you've given so far
Come back later!
 
9:14 PM
Oh I see what you mean @Mr.T I will fix that. Thanks for the notice. yeah try about co-founder
 
BTW @duncanC setting the time zone on NSDateFormatter doesn't work, show in EST is 10pm, but it gives me 7pm in PST. The show is at 10pm, which is why I do the offset
So just using NSDateFormatter gives me the time a show starts in PST, if I had a TV that played EST time shows
so at 7pm here, I can watch the show that starts at 10 in EST
 
Fix
 
so that is why I don't use straight up NSDateFormatter
@brianS do you know Time zones
 
A little
What is your question?
 
lol I'm trying to figure that out too
 
9:21 PM
Im just trying to get my app to display times right
Duncan told me only use NSDateFormatter, but from what I can tell it doesn't work the way Im using the dates
 
If that statement is true then you are using dates wrong :p
A date is simply an immutable point in time
 
So lets imagine it is Sunday. We know for a fact that The Strain starts at 10pm here. I have a NSDate, that has the time 10pm, but in EST
 
Yes thats correct you should use NSDateFormmatter
 
In fact it doesn't change wherever you go. The only thing that changes is the way you display it
 
So if I just use NSDateFormatter, I get back 7pm in California
I need it to give me 10pm
Well then help me :P I dunno what I am doing wrong
 
9:24 PM
You said that you already set the time zone to pacific time on the date formatter?
 
First of all you should use UTC for entire app
 
I have a feeling you are setting the time zone to "eastern" because you mistakenly think that a time zone is stored in an NSDate
 
I dunno, I'm confused by dates
 
Sorry just woke up, that is backwards
 
but since you already start using multiple time, you can simply convert them like this:
 
9:25 PM
should be eastern, you are probably setting it to pacific
A date is just a point in time
 
Lets just start from the beginning, I will grab a date for you from the server
 
 let dateFormatter = NSDateFormatter()
 dateFormatter.timeZone = NSTimeZone(abbreviation: "UTC")
 dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
 let timeStamp = dateFormatter.dateFromString() // USE THE FORMAT YOU DESIRE
 let timeToShow = NSDate().timeIntervalSinceDate(timeStamp!)
 
It doesn't care about time zones. You only need to care about them when displaying them to people.
 
Mr.T had the same problem this morning @Maximilian
 
so the date from Trakt to me is 2015-08-03T02:00:00.000Z
 
9:29 PM
Convert That
 
Yup, here is my method to make it a NSDate
class func dateFromString(string: String) -> NSDate? {
let dateFormatter = NSDateFormatter()
let enUSPOSIXLocale = NSLocale(localeIdentifier: "en_US_POSIX")
dateFormatter.locale = enUSPOSIXLocale
dateFormatter.dateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"

return dateFormatter.dateFromString(string)
}
and the date it returns is stored in core data, never changed again
unless there was no date before, every 24 hours I refresh the data and I will reset it, but its the same method
Look good so far?
 
And that return wrong time?
 
No its the right time
If you live in New York
 
but you want it to return converted time due to person location
 
This is why I am confused. Borrrden says time zones aren't stored in a NSDate
 
9:34 PM
They aren't
They are just seconds since epoch
 
Well do a print just to see if they are stored
 
Ok, so this is why I am confused, if I simply print that date with NSDateFormatter, I get 7:00 PM
but the show airs at 10:00 PM
 
If you don't explicitly set the time zone to format with, it will use your current time zone
 
OOOOO
 
If I set the time zone to EST on NSDateFormatter, I get 10:00 PM
 
9:35 PM
Yes @borrrden is right
 
Yes. so do I set the time zone to EST then?
 
Yes
 
Yes, that's exactly what you do
Because both answers are actually correct
 
...
well shit
that is easier
 
This point of time is 7 pm in california, AND 10 pm in new york
 
9:36 PM
exactly
This is why you should use UTC for all your times, trust me it will save you a lot down the road
 
Yes, thats why I made a method that added 3 hours, making the date 1 am in New York, but when printed it is 10 pm here
 
That would fail in other time zones ;)
 
or if you select MST in my app, then I make it 11 pm, and the formatter makes it 10pm again
 
Well I use UTC for all my app with no problem, I even store it into my RDS database as UTC
I love AWS
 
so PST people add +3 hours to the date, CST adds 2 hours, MST adds 1 hour, and I was trying to find a list of others to add to support other countries
@borrrden thats why I have a list of time zones, and people can pick the offset
 
9:39 PM
@Maximilian be master at one timezone and just convert it as you need it. don't let multiple zone confuse you
 
From the Trakt API page: "All dates will be GMT and returned in the ISO 8601 format like 2014-09-01T09:10:11.000Z. Adjust accordingly in your app for the user's local timezone.", so I need to convert that to UTC?
 
What is UST?
You mean UTC?
GMT and UTC are for most purposes the same
And by most I mean "If you are not a scientist working with atomic timing then you don't care"
 
What is UST?
 
University of Santo Tomas
In Manila :p
 
ok.. so my method I posted above, dateFromString, that is or is not converting the string to a UTC NSDate?
 
9:41 PM
Also, interestingly, the call sign for Northeast Florida Regional Airport
There is no such thing as a UTC NSDate
However, your formatter will parse the date into an NSDate correctly
(taking into account the time zone)
That's what the "Z" on the end is for. It's not a literal. "Z" means time zone
 
Zulu time zone
 
The "Z" in the date means "Zulu" which is another word for UTC, but the "Z" in the formatter means "read in the time zone"
It could be Z, or +0100, or -0900, etc
 
ok...so on the NSDateFormatter, I just set the time zone to EST, and no matter where my device is, it will say the show starts at 10:00 pm?
What if you live in the UK? I don think the show starts at 10:00pm there
 
You are setting it to the time zone you want to display it in
You understand that one point in time is several different times around the world right?
 
yes
 
9:47 PM
You have the point of time
point in time*
NSDateFormatter will just say how to display it
 
Its not going to work though
 
As part of the display process, you need to choose a time zone to display it in
If you choose eastern time, it will display 10 pm
If you choose pacific time, it will display 7 pm
If you don't set the time zone, it will display whatever time zone the device is currently in
 
In the US, the strain is every sunday at 10:00 pm at night, if you are in California, its at 10pm when its 10pm in california, if you are in NY, it airs at 10pm there, but when its 10pm there, its 7 here, but it does not start at 7 pm here
 
So the strain is on at 10 pm in new york AND in california?
Those are two different times
 
but if you are in France, its not going to air at 10pm Sunday night in France
Yes
 
9:49 PM
Then it should have two air times
Two NSDate objects
 
there isnt
 
Then it is wrong
 
Thats what I was doing
I store it in the date I get, and then in the app you select a time zone, and I apply an offset to the original date for that time zone
If you select PST, then I add 3 hours to the stored NSDate
and then display that with NSDateFormatter
so I was doing it correctly the entire time
 
But in central time it airs at 9
 
Yes, I have that zone as well
 
9:51 PM
What you should really do is complain to the backend service
They don't have all the correct information
 
I have EST, MST, CST, and PST
This is my time zone class, which has the offsets that I apply
and that is what I was asking @duncanc about, is how to display the rest of the time zones and then he said I was doing it wrong when I was doing it correctly the entire time :(
 
Well you are doing it wrong, but in this case it is a hack
Because the backend doesn't give you all of the times you need
 
Why is it wrong?
Keep it 1 date, because a user can change their offset, and if I change the date in the data, then the offsets will be different, E.G. selecting PST, change all dates +3 hours permanently, but then MST would be a different offset now then from the original.
 
In general it is wrong because it will end up changing the time
10 pm EST and 10 pm PST are NOT the same time
 
So I store the date they give me, and when I need to display the correct date I just apply an offset and then convert to string
 
9:56 PM
They are two distinct points in time
I think this is a shortcoming of Trakt
 
But I never change the date of the actual data, I am only changing the date so it can be displayed correctly
 
Right, so in this limited case you are doing what you need to
But in general case this is strange
 
I guess so
 
Duncan probably didn't realize that the show aired at two different times
 
but now back to my original issue, I can't find 1 source that gives the main time zones. Wikipedia gives me lots of stuff, Apple gives me 48 abbreviated time zones, and over 100 known time zones
I just need to make a list that allows any user in the world to have an offset, so if you live in Japan, there is a correct offset for the shows, or if you live in the UK
 
10:00 PM
-_-
 
Probably not, I guess I explained badly. To me, I am considering it 1 time, 10pm sunday night
 
Well first of all, which one are you going to offset?
 
but ya, its 2 different dates, but same time, same night
 
Most shows will air at something like 10pm EST / 7pm PST
Don't they say that anymore? "Weeknight at 7 eastern 4 pacific"?
 
No
I watch A LOT of TV, offsetting the EST time by 3 hours ahead gives me the correct time for a show always
Some cases it does air twice though, Like Arrow will air at 8pm and 10 I think?
 
10:02 PM
Weird....have things changed so much since I was a kid -_-
If so then Trakt is even more stupid for not accounting for this
 
Some will air on the exact same date, E.G. 5pm PST, 8pm EST, so you watch it at the same time. but then it will air 3 hours later as well
but for the most part, just doing a 3 hour offset is the correct showtime for me so ya
 
Ok well then which date are you going to offset?
10 pm eastern or 10 pm pacific?
 
10 pm eastern
 
I doubt that will be useful in Japan since we don't get FX anyway
 
lol, well the strain is what I am using as example, but same for all shows
 
10:04 PM
Or any American broadcast channels for that matter
Well Japan only has one time zone so things are simple :p
 
well.. you get TV Tokyo?
 
Yes
And the air time is the same all throughout the country hehe
 
Well then you can track Naruto:P
I get notifications for Naruto at 3am whenever its on
 
Do you watch it via TV Tokyo?
 
nope
 
10:05 PM
Then why bother? lol
 
I watched some on hulu, but half the season isn't dubbed so... I'm stuck
I can watch the sub versions, but when I watch TV I also program, can't read TV and program at same time
but anyways, so I need time zone for Hawaii (+6 hours then since PST is +3?)
and I need Japans
Japan is -16
 
But in general, you should do it this ay
way
The way that we described
That will work for Japan and other countries etc
And you can handle the exceptions (10 pm AGAIN in pacific time)
The way you are doing now
 
wait what is your way? Store each date separate?
so store a time for PST, store the different time for EST and just use a plain NSDateFormatter to make a string?
 
Just use an NSDateFormatter
And set the time zone, unless it is one of the freak ones
 
oh. yup
Well I would just use NSDateFormatter if it was 1 time zone
 
10:11 PM
Can you paste the exact response you get from Trakt, I'm curious about it
No one outside of PST is going to care about the PST time
 
Trakt says: "All dates will be GMT and returned in the ISO 8601 format like 2014-09-01T09:10:11.000Z. Adjust accordingly in your app for the user's local timezone."
 
Right, that means NSDateFormatter
Oh I meant the response from the Trakt API call (are you using their REST API?)
 
Ya, heres a image of the exact response
I get it in JSON
Ah. Using your map you sent, I see the issues. So in 1 zone, there can be many different names but its still just a -4 hours time.. Well thats damn confusing, can't we just have 1 name for each place with a offset? Besides like GMT+X/-X
So the other TV app did it right, have to have a list from -16 to +16, give no names
 
10:39 PM
Should Allow people to search for posts?
Or bring it in later update?
 
search!
 
-16 to +16 is 33 time zones for 24 hours lol
-11 to +12
 
11:05 PM
Wow u guys still talking about timezone?
 
11:47 PM
Evening girls.
 
00:00 - 20:0020:00 - 00:00

« first day (1065 days earlier)      last day (1091 days later) »