Closed Bug 954039 Opened 7 years ago Closed 2 years ago

Date and time in message style themes

Categories

(Instantbird :: Other, defect)

defect
Not set
minor

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 954852

People

(Reporter: Mic, Unassigned)

References

(Blocks 1 open bug)

Details

*** Original post on bio 602 at 2010-11-26 15:05:00 UTC ***

The simple theme doesn't allow to see on which day a message was received. That can be a problem if you keep a window open for several days. Maybe adding it to a tooltip of the time would help.

We should check that other default themes don't have the same problem. Maybe mentioning it on the create a message theme wiki article could be helpful to others. (e.g. if it's wanted as a basic feature we could add a "what your theme should support"- check list?)
*** Original post on bio 602 at 2010-12-16 08:59:51 UTC ***

(In reply to comment #0)
> The simple theme doesn't allow to see on which day a message was received. That
> can be a problem if you keep a window open for several days. Maybe adding it to
> a tooltip of the time would help.

My idea to solve this problem was to include automatically a system message with the new date when a message is added and doesn't have the same date as the previous message.
I think Pidgin does this.

I haven't found a good wording for that system message yet though :-/.
I thought about using the full letters version of the date, but I haven't found any formatter (of the date formating method) to do that correctly.
*** Original post on bio 602 at 2011-10-31 16:53:55 UTC ***

(In reply to comment #1)
> (In reply to comment #0)
> > The simple theme doesn't allow to see on which day a message was received. That
> > can be a problem if you keep a window open for several days. Maybe adding it to
> > a tooltip of the time would help.
> 
> My idea to solve this problem was to include automatically a system message
> with the new date when a message is added and doesn't have the same date as the
> previous message.
> I think Pidgin does this.
> 
> I haven't found a good wording for that system message yet though :-/.
> I thought about using the full letters version of the date, but I haven't found
> any formatter (of the date formating method) to do that correctly.

What do you mean by "full letters version of the date"?
*** Original post on bio 602 at 2011-10-31 16:59:12 UTC ***

(In reply to comment #2)

> What do you mean by "full letters version of the date"?

Something like "Monday, December 17, 2012" for example. Rather than having "Mon" for the day, etc...
*** Original post on bio 602 at 2011-10-31 20:20:54 UTC ***

(In reply to comment #3)
> (In reply to comment #2)
> 
> > What do you mean by "full letters version of the date"?
> 
> Something like "Monday, December 17, 2012" for example. Rather than having
> "Mon" for the day, etc...

<date object>.toLocaleDateString() seems to do what you want.


An example (c/p to the error console) and its output:

> var today = new Date(); today.toLocaleDateString();
> Montag, 31. Oktober 2011

See: https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date#Methods_2
*** Original post on bio 602 at 2011-10-31 20:58:17 UTC ***

(In reply to comment #4)

> > var today = new Date(); today.toLocaleDateString();
> > Montag, 31. Oktober 2011

When I try this (on Firefox 7, installed in en-US on my French Mac OS X 10.5), the result is:
10/31/2011
*** Original post on bio 602 at 2011-11-01 13:23:27 UTC ***

Then maybe this:

> var locale = "en-US"; var dts = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].getService(Components.interfaces.nsIScriptableDateFormat); dts.FormatDate(locale, 1, 2011, 10, 16);

Output for locale = 

"de":    "Sonntag, 16. Oktober 2011"
"en-US": "Sunday, October 16, 2011"
"en-GB": "16 October 2011"
"es":    "domingo, 16 de octubre de 2011"
"fr":    "dimanche 16 octobre 2011"
"pt":    "domingo, 16 de outubro de 2011"
"ru":    "16 октября 2011 г."  <- Google Translate says this is October, 16th, no weekday though
"sv":    "den 16 oktober 2011"   <- that's swedish, no weekday though.


Sources:
Interface:
> http://mxr.mozilla.org/mozilla-central/source/intl/locale/idl/nsIScriptableDateFormat.idl
Implementation: 
> http://mxr.mozilla.org/mozilla-central/source/intl/locale/src/nsScriptableDateFormat.cpp
*** Original post on bio 602 at 2011-11-01 13:28:29 UTC ***

I haven't checked the code if toLocaleDateString is using exactly this and you're going to suffer from the same problem as before. At least here on Windows this function seems to be good enough for just anything.
*** Original post on bio 602 at 2011-11-01 13:50:00 UTC ***

(In reply to comment #7)
> I haven't checked the code if toLocaleDateString is using exactly this and
> you're going to suffer from the same problem as before. At least here on
> Windows this function seems to be good enough for just anything.

More bugspam! I'm quite sure now that this is almost solely an OS thing.
We can either do it ourselves and try to get it right (i.e. localizers might have to provide a proper format for their dates and the names of the weekdays?) or we take what we can get from Mozilla and be happy with it.
*** Original post on bio 602 at 2011-11-01 13:52:20 UTC ***

(In reply to comment #6)
> Then maybe this:
> 
> > var locale = "en-US"; var dts = Components.classes["@mozilla.org/intl/scriptabledateformat;1"].getService(Components.interfaces.nsIScriptableDateFormat); dts.FormatDate(locale, 1, 2011, 10, 16);

That gives better results. Ironically, on Mac it gives the week day only for Swedish... one that you didn't have on Windows :-D.
Blocks: 1099067
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 954852
You need to log in before you can comment on or make changes to this bug.