AquaMail Forum

English - Android => How do I... => Topic started by: paule11 on August 04, 2015, 12:39:53 am

Title: AM/PM or 24 hour time-format in replies
Post by: paule11 on August 04, 2015, 12:39:53 am
hello everybody,

sorry to bother you with this question - I tried finding a solution in this forum and via websearch but wasn't lucky.
If you are in a hurry, only read the bold parts.

I'm using the german pro Version (1.5.7.29).
When I reply with the original mail quoted Aqua Mail writes the time of the original mail in a somewhat strange format (bold is to emphasize and not coming from the app), eg.  "Am 3. August 2015 11:13:23 nachm. schrieb...".
Unfortunately I wasn't able to set Aqua Mail to use 24-hour mode there.
What I would like to achieve is that it reads "Am 3. August 2015 (um) 23:13:23 schrieb..."
Both reply-formats "Thunderbird/Gmail" and "Outlook" do use am/pm and not 24h-mode.

Question:
How can I set Aqua Mail to use 24h-mode in the "header-section" of the quoted mail when replying?

Thanks a lot!!
Paule
Title: Re: AM/PM or 24 hour time-format in replies
Post by: mikeone on August 04, 2015, 08:13:33 am
Hi Paule,

There is no special setting in AquaMail.
However, you can change this option in Android system settings itself:
Go to the section "System / Datum &  Uhrzeit [Date & time] " > enable "24-Stunden Format [Use 24-hour format]". If it is already enabled, then disable / enable this option. That should be solve your issue.

Regards
Mikeone
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 04, 2015, 12:59:04 pm
I believe this is relatively "easy to add" feature for Kostya.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: mikeone on August 04, 2015, 06:27:29 pm
I assume that's not really needed in AquaMail, since this option is sufficient controlled at Android's system level.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 04, 2015, 07:01:22 pm
But I suppose he wants to use 12 hour mode in the whole system, just in AquaMail 24-hr mode for replies.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 04, 2015, 08:36:30 pm
Quote
But I suppose he wants to use 12 hour mode in the whole system, just in AquaMail 24-hr mode for replies

Then that's the time to decide, which format he / she really likes best.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 04, 2015, 08:50:47 pm
I've seen a very minor bug in Aqua Mail that after a device restart the time format in replies defaults to 12h, even if the system default is 24h. The workaround is to switch the time format to 12h and back to 24h in the Android settings. Didn't find it worth reporting. Maybe it matches the issue the TO sees here.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 04, 2015, 08:59:08 pm
Re: "12 / 24h bug" -- just checked the code, I use a standard Android function to format the time, and it's actually called every time (e.g. the value isn't cached). So maybe it's a minor bug in Android itself..
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 04, 2015, 09:21:56 pm
Re: "12 / 24h bug" -- just checked the code, I use a standard Android function to format the time, and it's actually called every time (e.g. the value isn't cached). So maybe it's a minor bug in Android itself..

It was an Android 5.0.x bug then. If I terminate Aqua Mail Pro on my Xperia Z3 compact with Android 5.0.2 and launch the app again, the time format defaults to 12h when replying despite 24h set system-wide. But I can't reproduce this on my Nexus 7 with the latest 5.1.1 anymore (but I definitely experienced the issue there as well a while ago). So it might have been already fixed by Google.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: mikeone on August 04, 2015, 09:22:47 pm
I've seen a very minor bug in Aqua Mail that after a device restart the time format in replies defaults to 12h, even if the system default is 24h. The workaround is to switch the time format to 12h and back to 24h in the Android settings. Didn't find it worth reporting. Maybe it matches the issue the TO sees here.
Yes,  I can confirm this behavior... unfortunately also with latest 5.1.1 ...and how Kostya explained it seems to be a bug in Android itself.
Therefore the only workaround to fix this issue is as described by you (... and mentioned in my previous post: http://www.aqua-mail.com/forum/index.php?topic=3815.msg19585#msg19585)
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 04, 2015, 09:28:58 pm
https://code.google.com/p/android/issues/detail?id=181201
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 04, 2015, 09:55:40 pm
I can confirm this behavior... unfortunately also with latest 5.1.1

It was an error on my side, sorry. I forgot that my Xperia Z3 compact had been updated to 5.1.1 yesterday :-[
Still wondering why I couldn't reproduce it on my Nexus.

@Kostya:

Thank you for finding the bug report.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 05, 2015, 12:58:45 pm
Quote
But I suppose he wants to use 12 hour mode in the whole system, just in AquaMail 24-hr mode for replies

Then that's the time to decide, which format he / she really likes best.

Just use h instead of H in your SimpleDateFormat (if that option is enabled)
Title: Re: AM/PM or 24 hour time-format in replies
Post by: paule11 on August 05, 2015, 04:08:59 pm
thank you everybody for explaining what's going on!!
And Kostya, thank you for getting involved right away!

I tried switching back and forth and it works for some time. However after a while AquaMail shows the 12h-format again.
Phone is a Galaxy S4 running 5.1.1 (OptimizedCM-12.1-20150725-jflte / LMY48G / Firmware XXUAMDE) from a thread over at xda-developers (title: [JDCTeam][5.1.1][25 July] Optimized CyanogenMod 12.1 builds)
However, since I installed xposed I can't hope for support from their side.

Quote
But I suppose he wants to use 12 hour mode in the whole system, just in AquaMail 24-hr mode for replies

Then that's the time to decide, which format he / she really likes best.

Just use h instead of H in your SimpleDateFormat (if that option is enabled)

Didn't mean to confuse - my phone is and was set to 24h and I want to keep it that way.

Kostya, is there anything you can do about it (use h instead of H)?
Or do we have to wait for google (maybe as well custom rom creators?) to fix it?


Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 05, 2015, 04:30:39 pm
I don't use SimpleDateFormat.

My code is:

Quote
DateFormat.getDateTimeInstance(DateFormat.LONG, DateFormat.MEDIUM).format(new Date(when));

http://developer.android.com/reference/java/text/DateFormat.html#getDateTimeInstance(int, int)

Quote
Returns a DateFormat instance for formatting and parsing of both dates and time values in the manner appropriate for the user's default locale.

Since it does consider the user setting fof 12/24 at least most of the time -- then clearly it's intended to do so.

That it doesn't do this all the time -- clearly is a bug in this function, since my code calls it with identical parameters every time and doesn't cache the value.

See comment #3 in the bug report I've linked above.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 05, 2015, 04:53:21 pm
I just tested the system level setting for "use 24 hour format" on two devices: Sony Z2 with 5.1 and Nexus 5 with M Preview.

The message header (when replying / forwarding) did use the current setting, I've tried changing back and forth too.

So there must be a subtle bug maybe having to do with Android boot-up (I mean in Android code, not AquaMail).
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 05, 2015, 06:09:06 pm
But Paule wants option to make it independent from system setting. Talks about Android and its bug related to time mose should not be in this thread.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 05, 2015, 06:22:01 pm
But I don't want to add this option -- the system level setting "should be enough for everyone".

Every new setting:

- Makes the code more complex even if it's just a little bit, it adds

- Adds possibility for misuse ("why are times formatted as am/pm if my system level setting is use 24 hours")

- This then becomes a support issue

- For a small feature like that, I can easily forget it's even there, and so it becomes a support issue again

- Translations

Sorry, I fail to see why the system level setting is not enough.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 05, 2015, 07:33:40 pm
But Paule wants option to make it independent from system setting. Talks about Android and its bug related to time mose should not be in this thread.

Unless I got it really wrong, the TO never asked explicitly for an independent switch within Aqua Mail but wanted it to follow the system-wide setting, which was 24h in his case. This is precisely what the Android bug report is about.

P.S.: The issue remains elusive on my Nexus 7, even after a full restart, with background sync in AM on as well as off.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: mikeone on August 05, 2015, 10:58:15 pm

Unless I got it really wrong, the TO never asked explicitly for an independent switch within Aqua Mail but wanted it to follow the system-wide setting, which was 24h in his case. This is precisely what the Android bug report is about.
Yes,  you are correct.
Quote
P.S.: The issue remains elusive on my Nexus 7, even after a full restart, with background sync in AM on as well as off.
Currently I can't reproduce this issue on my Xperia Z3 with Android 5.1.1 any more. It seems to be fixed after switching 12/24-format back and forth in Android system settings (once only right now). But maybe it will come back again...

... or maybe (finally) fixed by Kostya with build 1.5.9.5 yesterday:
[that's what I believe > Android's system code fixed by telepathy 8)]

8332 f1164266f2e9 2015-08-04 21:28 +0300 kmansoft Set am/pm when setting time
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 05, 2015, 11:23:46 pm
"... or maybe (finally) fixed by Kostya with build 1.5.9.5 yesterday:
[that's what I believe > Android's system code fixed by telepathy 8)]

8332 f1164266f2e9 2015-08-04 21:28 +0300 kmansoft Set am/pm when setting time
"

Nope, that one is for time picker in the "Send later.." dialog.

The "am" and "pm" buttons.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: mikeone on August 05, 2015, 11:50:16 pm
... ah, okay.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 06, 2015, 01:14:55 am
One other thing:

I've done some tests and there is a different formatting function which observes the system level "use 24 hour format" setting (haven't tested with rebooting the phone, though).

However:

On a phone that is set to Russian language, it's applied too.

On this phone, I happen to have that setting "off" -- so it comes out as "2:12 pm".

But we don't use am/pm in Russia, so "2 pm" is just "whoa, what is that?"

[ Or actually, we do but only when speaking, not in writing, and there is no shorthand, we say "8 in the morning" or "2 in the day" or "9 in the evening"  ]

So let's say I make the change and some number of Russian users start seeing am/pm in their replies. This is wrong.

Some of them will contact me (unhappy about the change), some won't, and decide that the app is "broken".

Do I make a special case for Russian, based on the locale == "ru"?

Ok, what if someone from Russia actually wants to use the 12 hour am/pm format, a personal preference?

Do I now need to add yet another setting ("override system level setting")?

Will the users who think that "the app is broken" be able to find it without my help?

Is Russia the only country where there is no 12 hour am/pm format?

If not, what are the others, where do I get the full list?

---

To summarize, something that looks like a really trivial change, may turn out to be very complicated if you consider the consequences.

In this respect, the "bigger" features (like the recent message view changes) are often easier.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 06, 2015, 07:49:38 am
Here in Slovakia we have pretty much same system. The only thing which can help is make setting "Hours mode" and pick AM/PM or 24 hr mode.

Or:
Can you manually format time (by code ofc) to 12/24 hr mode? And then check if 24 hr mode enabled in system and use new formatted time as workaround on LP.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 06, 2015, 01:19:04 pm
I've done some tests and there is a different formatting function which observes the system level "use 24 hour format" setting (haven't tested with rebooting the phone, though).

However:

On a phone that is set to Russian language, it's applied too.

On this phone, I happen to have that setting "off" -- so it comes out as "2:12 pm".

But we don't use am/pm in Russia, so "2 pm" is just "whoa, what is that?"

[ Or actually, we do but only when speaking, not in writing, and there is no shorthand, we say "8 in the morning" or "2 in the day" or "9 in the evening"  ]

This is very much like in German, and even saying "um 11:13:23 nachmittags" would be awfully wrong (spoken "um 11 Uhr 13 abends" would have been correct). Actually, I think that the mere idea to offer a 12h time format in the Android settings for the German locale is completely bogus. Neither Linux with GNOME nor Windows has such an option.

Quote
Do I make a special case for Russian, based on the locale == "ru"?

I tried to understand starting from

Code: [Select]
lxr.mozilla.org/comm-central/search?string=mailnews.reply_header_authorwroteondate
(I may not post URLs, maybe it will work this way) how the big guys are treating the time and date format. While I've failed on that, it does seem to me that it is a) locale based and b) the 12h mode exists only for the Calendar and on Android for the date and time picker:

Code: [Select]
lxr.mozilla.org/comm-central/search?string=12hour
Quote
Ok, what if someone from Russia actually wants to use the 12 hour am/pm format, a personal preference?

Do I now need to add yet another setting ("override system level setting")?

My personal favorite would be plain ISO 8601. Or a choice between ISO 8601 as default and any garbage Android returns when asked for date and time ;)

Quote
Is Russia the only country where there is no 12 hour am/pm format?

If not, what are the others, where do I get the full list?

Add at least Germany to the list.

Thanks!
Title: Re: AM/PM or 24 hour time-format in replies
Post by: paule11 on August 06, 2015, 01:25:57 pm
Yes, disposable_bag and Mikeone are correct - I never asked for the possibility to have an independent setting in AquaMail.
Nonetheless pyler's suggestion of having some sort of override to format the time to 24h-mode would be absolutely great!
Kostya, if it's rather easy, would you add a function that says something like "For Lollipop users with 12/24h-mode issue, please check this box, to format time according to 24h-mode". Maybe that would be self-explanatory enough for people to understand what the setting does and why it is there in the first place?
....just an idea of course. I do absolutely understand your concerns about adding such a feature!
Just asked in the xda-thread if someone encounters the same issue and if there is a fix that works (on system-level).
I think nobody expects individual apps to fix system-bugs!? (at least I don't!).

Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 06, 2015, 01:36:21 pm
If there's room to enhancements, then
- improving message header display
- RTL "major direction" (needed for semitic languages)
- "undo" delete / archive
- etc.
should be considered as having a higher priority.

I fully agree, especially if my pet enhancement http://www.aqua-mail.com/forum/index.php?topic=3554.msg19413#msg19413 would get on the list ;)
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 06, 2015, 02:44:33 pm
But please not fix it like Google - Obselete, wont fix.  :D

getDateTimeInstance has third argument Locale object, so if everything is ok in e.g. X locale, pass X locale to this method.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 06, 2015, 03:59:15 pm
"Actually, I think that the mere idea to offer a 12h time format in the Android settings for the German locale is completely bogus"

This, 100%.

I was *shocked* to find that the setting is enabled (and set to "12 hrs, am/pm") on two phones set to Russian language.

"getDateTimeInstance has third argument Locale object"

I already use that one if the user enables "Force English in reply headers" (or whatever I've called it), passing in Locale.US.

"As far as 12/24 is concerned, I strongly recommend to leave the app as it is currently"

That's what I'm going to do.

Apparently my attempts to explain -- what a "can of worms" this is, or to use another expression "rathole" -- mostly failed.

Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 06, 2015, 05:53:54 pm

Quote from: Paris Geek
As far as 12/24 is concerned, I strongly recommend to leave the app as it is currently

That's what I'm going to do.

Apparently my attempts to explain -- what a "can of worms" this is, or to use another expression "rathole" -- mostly failed.

With that said, you don't feel like the unabmiguous ISO 8601 for both date and time format would be the way to keep clear of this can of worms, do you?

Maybe reimagining just "Force English in reply headers" as ISO 8601 instead of implying that English has something to do with the US locale? English is rather the modern exterritorial lingua franca, and the reason to choose English in reply headers is mostly to facilitate communication with people across different cultures who do understand the language but not necessarily the peculiar US date and time format.

This way the default behavior of Aqua Mail would not require any modifications.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: disposable_bag on August 06, 2015, 06:26:18 pm
Maybe reimagining just "Force English in reply headers" as ISO 8601 instead of implying that English has something to do with the US locale? English is rather the modern exterritorial lingua franca, and the reason to choose English in reply headers is mostly to facilitate communication with people across different cultures who do understand the language but not necessarily the peculiar US date and time format.

Oops, I should have tried this setting myself, as it keeps the time format in the 24h mode if set so in the system-wide settings (unless the aforementioned, sometimes elusive Android bug strikes again) :-[
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 06, 2015, 06:41:52 pm
I don't have any particular tenderness in my heart for ISO 8601, especially for things like:

"2015-08-02T21:50:49+03:00"

Who in the world is going to be able to understand this? Except you and maybe three other people?

"Ok, me, John, and Mary, and who is the third one", I hear you ask :)

The "Use English" setting is precisely for people whose phones are set to their national language, and yet they don't want this language to be used in quoting (because the other parti(ies) don't know it).

"US English" is apparently just fine for all these users -- just as long as it's "On ... August ... wrote" and not "... написал ... августа".

And so I have no intention to touch this at all, unless something truly serious surfaces up.
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 26, 2015, 03:00:29 pm
http://review.cyanogenmod.org/#/c/107718/

Possible fix?
Title: Re: AM/PM or 24 hour time-format in replies
Post by: Kostya Vasilyev on August 26, 2015, 10:46:06 pm
Yeah, really looks like it could be...
Title: Re: AM/PM or 24 hour time-format in replies
Post by: pyler on August 27, 2015, 11:44:51 am
https://code.google.com/p/android/issues/detail?id=181201#c7

But a Googler couldn't reproduce it, it had worked in his tests.