andrewmm / ncwunderground

iPhone Notification Center Widget for Weather Underground
8 stars 1 forks source link

Obey region format when displaying time #22

Closed dborca closed 11 years ago

dborca commented 11 years ago

For example, some countries use 15:34 instead of 3:34 PM. This should be independent of the selected language.

andrewmm commented 11 years ago

Added in 74d56b2a1a93ce6d5fd60d0866aaa1f8ebc4c411.

dborca commented 11 years ago

It still shows 4 PM -> 3AM over temperature SparkLine graph. My region format would look like 16:00 -> 03:00. This happens because of -hourlyTime12HrString(int)

andrewmm commented 11 years ago

Ah; I forgot about this time string; I localized the other. Thanks. — Andrew MacKie-Mason

On Fri, May 10, 2013 at 7:52 AM, dborca notifications@github.com wrote:

It still shows 4 PM -> 3AM over temperature SparkLine graph. My region format would look like 16:00 -> 03:00. This happens because of -hourlyTime12HrString(int)

Reply to this email directly or view it on GitHub: https://github.com/andrewmm/ncwunderground/issues/22#issuecomment-17718398

andrewmm commented 11 years ago

Addressed in 7196b75a6e72f1b7aab587a0209864afce1fd726; needs to be tested.

dborca commented 11 years ago

Looks good to me.

However, I'd use "%d:00" because it better conveys a feeling of time display (which AM/PM gives in other locales).

Thanks.

andrewmm commented 11 years ago

a3ec494.

dborca commented 11 years ago

Hi,

It seems that [NSDateFormatter dateFormatFromTemplate:options:locale:] follows more the template than the locale (mine is ro_RO). It shows 6:07:38 PM.

I'm no expert in date formatters, I always used [dateFormatter setDateStyle:NSDateFormatterShortStyle]; [dateFormatter setTimeStyle:NSDateFormatterShortStyle]; and forgot about it.

Besides, @"h:mm:ss a" display is confusing if the widget was set to Manual and was not refreshed for more than a day.

dborca commented 11 years ago

One more thing: seems like dateFormatFromTemplate:@"h:mm:ss" (without the 'a') still shows 6:17:04 PM on my locale, while [dateFormatter setTimeStyle:NSDateFormatterShortStyle] shows 18:17. Hmm...

andrewmm commented 11 years ago

In settings, do you have 24 hr time turned on? — Andrew MacKie-Mason

On Tue, May 21, 2013 at 10:20 AM, dborca notifications@github.com wrote:

One more thing:

seems like dateFormatFromTemplate:@"h:mm:ss" (without the 'a') still shows 6:17:04 PM on my locale, while [dateFormatter setTimeStyle:NSDateFormatterShortStyle] shows 18:17. Hmm...

Reply to this email directly or view it on GitHub: https://github.com/andrewmm/ncwunderground/issues/22#issuecomment-18215815

dborca commented 11 years ago

In Settings -> General -> International, I have:

Language: English Voice Control: English Keyboards: 2

Region Format: Romania Calendar: Gregorian

Region Format Example sâmbătă, 5 ianuarie 2013 00:34 4085551212

As I said earlier, [dateFormatter setTimeStyle:NSDateFormatterShortStyle] shows 18:17, NOT 6:17 PM.

andrewmm commented 11 years ago

What about in Settings > General > Date & Time?

dborca commented 11 years ago

Yes, it is ON.

andrewmm commented 11 years ago

Resolved in 4b11cf4. Used NSDateFormatterShortStyle, as @dborca suggested.