Author Topic: 12 vs. 24 hour date in reply quoting header  (Read 10312 times)

oneeyed

  • Guest
12 vs. 24 hour date in reply quoting header
« on: September 15, 2016, 10:20:02 pm »
When forwarding a mail anonymously, the date uses a 12 hour format even if the device uses a 24 hour format. The forward should use the locale for hour formatting.
« Last Edit: September 16, 2016, 06:23:52 pm by Kostya Vasilyev, Aqua Mail »

StR

  • Hero Member
  • *****
  • Posts: 1558
Re: Anonymous forward uses 12 hour date
« Reply #1 on: September 15, 2016, 10:43:02 pm »
Would you mind explaining this in more detail:
- Where does the date appear in a 12-hour format (in which portion of the e-mail? Is it the "Date:" header?
- Where do you observe this (on the recipient's phone, on recipient's computer, ... )?
- In which program/app?

If it is not too difficult, please post a screenshot.

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #2 on: September 15, 2016, 10:58:17 pm »
When I forward a message anonymously, the body repeats partial information about the headers of the forwarded message (Date and Subject).

The Date information contains the day in the phone locale (French in my example) while the hour uses 12 hour AM/PM format (while in the phone locale it should use 24 hour format).

A screenshot is attached. I would expect to read "Date: 15 septembre 2016 21:46:15" instead of "Date: 15 septembre 2016 9:46:15 PM".


mikeone

  • Hero Member
  • *****
  • Posts: 2762
Re: Anonymous forward uses 12 hour date
« Reply #3 on: September 15, 2016, 11:00:52 pm »
Would you mind explaining this in more detail:
- Where does the date appear in a 12-hour format (in which portion of the e-mail? Is it the "Date:" header?
- Where do you observe this (on the recipient's phone, on recipient's computer, ... )?
- In which program/app?

If it is not too difficult, please post a screenshot.
The 12 hour time appears in the header of the 'forwarded' / 'replied' message.
> Forward  / Forward  (anonymous) / Reply / Reply to all
« Last Edit: September 15, 2016, 11:03:38 pm by mikeone »

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #4 on: September 16, 2016, 12:26:35 am »
Please post a screeshot of the original message, and of the setting choice of Language. Is it French or System? Try French.

See the screenshots from mikeone in this thread, I get the very same behaviour (date on the original mail was displayed in 24 hour format).

Using "Français" instead of "System (Français)" as the language setting does not change a thing. As for mikeone, even the reply uses 12 hour format as an intro: « Le 15 septembre 2016 9:49:15 PM XXX <xxx@xxx> a écrit : ».

mikeone

  • Hero Member
  • *****
  • Posts: 2762
Re: Anonymous forward uses 12 hour date
« Reply #5 on: September 16, 2016, 12:39:00 am »
I just discovered that the time 12 / 24 depends on the settings > Look and feel > Language:

Please try to toggle (switch)  between Francais <> English and also change / rechange the system settings "Date &  Time"

For me it's fixed now.

« Last Edit: September 16, 2016, 12:43:11 am by mikeone »

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #6 on: September 16, 2016, 01:13:19 am »
I just discovered that the time 12 / 24 depends on the settings > Look and feel > Language:

Please try to toggle (switch)  between Francais <> English and also change / rechange the system settings "Date &  Time"

For me it's fixed now.

I did that (System (français) / Français / English (US) / English (UK)) to no avail, and any setting gives me the 12 hour format…

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #7 on: September 16, 2016, 01:18:42 am »
Changing the system language settings don't help either.

Anyway, I'm not so much looking for a workaround than willing to report the bug.

mikeone

  • Hero Member
  • *****
  • Posts: 2762
Re: Anonymous forward uses 12 hour date
« Reply #8 on: September 16, 2016, 08:32:16 am »
Changing the system language settings don't help either.

Anyway, I'm not so much looking for a workaround than willing to report the bug.

Okay, but I'm not sure if this is really 'a bug' in AquaMail, since the setting "Use 24-hour format" is deliivered by the system (device settings). But... who knows.

Any success with changing the settings "Date & Time" (untoggle / toggle "Use 24-hour format") - not only the Language settings - on system level as mentioned in my previous post?

I just discovered that the time 12 / 24 depends on the settings > Look and feel > Language:

Please try to toggle (switch)  between Francais <> English and also change / rechange the system settings "Date &  Time"

For me it's fixed now.
« Last Edit: September 16, 2016, 08:43:12 am by mikeone »

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #9 on: September 16, 2016, 12:55:50 pm »



Okay, but I'm not sure if this is really 'a bug' in AquaMail, since the setting "Use 24-hour format" is deliivered by the system (device settings). But... who knows.

Any success with changing the settings "Date & Time" (untoggle / toggle "Use 24-hour format") - not only the Language settings - on system level as mentioned in my previous post?


The system settings is used unless another one is explicitly requested (such as en_US) when formatting the time.

I have tried toggling the system 24 hour setting several times (its default state is on for me) and it didn't change anything.

Note : Android 7 on N5X with both the stable and beta versions of Aquamail.

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: Anonymous forward uses 12 hour date
« Reply #10 on: September 16, 2016, 03:39:50 pm »
The code does exactly same date formatting for "anon" vs. "regular" forwarding vs. "reply":

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


The issue of 12 vs. 24 hour formatting has come up before, and back then we discovered a bug on this in the Android bug tracker.

http://www.aqua-mail.com/forum/index.php?topic=3815.0

https://code.google.com/p/android/issues/detail?id=181201
Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/

oneeyed

  • Guest
Re: Anonymous forward uses 12 hour date
« Reply #11 on: September 16, 2016, 04:36:32 pm »
The code does exactly same date formatting for "anon" vs. "regular" forwarding vs. "reply":

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


The issue of 12 vs. 24 hour formatting has come up before, and back then we discovered a bug on this in the Android bug tracker.

http://www.aqua-mail.com/forum/index.php?topic=3815.0

https://code.google.com/p/android/issues/detail?id=181201

Something is very strange then. I just created an empty project from the default Android Studio template whose only purpose is to print the result of the code you use: https://github.com/samueltardieu/DateTest

The exercized code is https://github.com/samueltardieu/DateTest/blob/master/app/src/main/java/rfc1149/net/datetest/MainActivity.java#L34-L41

On the same device (Nexus 5X using Android 7.0), without altering anything in settings between repeated runs of both applications (both killing and not killing them in-between), AquaMail displays "15 septembre 2016 9:49:15 PM" when anonforwarding/regularforwarding/replying, and DateTest (the test application) "15 septembre 2016 21:49:15".

It is possible that AquaMail somehow changes something within its application context that makes the system resort to using a 12 hour format. Does it do any `Locale.setLocale()` by chance even when the default locale is selected in AquaMail? If the Android runtime was just plain bogus, then the DateTest application should exhibit the same problem.

I also tried changing the targetSdkVersion and the minSdkVersion in the DateTest application to see if it changes anything, but it doesn't, I cannot reproduce AquaMail behaviour within the test application with the same code.

StR

  • Hero Member
  • *****
  • Posts: 1558
Re: Anonymous forward uses 12 hour date
« Reply #12 on: September 16, 2016, 05:29:08 pm »
Kostya, if you haven't done that recently, take a look at the last two posts (very recent) in the thread on code.google site that you linked.
Apparently (#20) someone from the project is looking into it, and #21 is asking to "point to an app (in the Play Store) that they can reliably reproduce this with". Maybe you want to volunteer Aquamail for that?

BTW, just an additional data point: I see the same mis(behavior) under Android 4.1.2.
(So, it was not introduced in 5.x., as the OP in that linked code.google thread implied.)

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: Anonymous forward uses 12 hour date
« Reply #13 on: September 16, 2016, 05:36:20 pm »
Quote
It is possible that AquaMail somehow changes something within its application context that makes the system resort to using a 12 hour format. Does it do any `Locale.setLocale()` by chance even when the default locale is selected in AquaMail? If the Android runtime was just plain bogus, then the DateTest application should exhibit the same problem.

It only calls setLocale if the user has selected any locale, not "system locale":

https://gist.github.com/kmansoft/e1e76a7df61e8dfb90e34bbc50e43e50

Aqua's targetSdk is 21.

Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/

Kostya Vasilyev

  • Hero Member
  • *****
  • Posts: 12740
Re: Anonymous forward uses 12 hour date
« Reply #14 on: September 16, 2016, 05:40:36 pm »
Quote
Apparently (#20) someone from the project is looking into it, and #21 is asking to "point to an app (in the Play Store) that they can reliably reproduce this with". Maybe you want to volunteer Aquamail for that?

Just did, added your new data point (re: 4.2.1) too.
Creating debug logs for diagnostics: https://www.aqua-mail.com/troubleshooting/

The official FAQ: https://www.aqua-mail.com/faq/

Лог-файлы для диагностики: https://www.aqua-mail.com/ru/troubleshooting/

Вопросы и ответы: https://www.aqua-mail.com/ru/faq/