Page 1 of 1

Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-03-22, 22:19
by back0rifize
Good day's time!

After updating PM to version 27.2.0, I've got an issue with current date displaying: in Russia, we have DD.MM.YYYY format, but now it shows DD/MM/YYYY. It's not critical, but I would like to know the reason: maybe there was some changes in toLocaleDateString() method or it's a localization issue, or something else?

Thank you!

Re: Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-03-23, 10:32
by Moonchild
The ICU library was updated which handles internationalization. It seems the separator character has been changed but without looking into it in more detail (and without knowing exactly the code creating the date you show here) it'll be difficult to find the reason.

Yes it's possible that toLocaleDateString() has changed and that the library update introduced a bug... but some more details are needed. Can you provide some steps to reproduce and find out what is done correctly and what is done wrong? Did you check your O.S./system settings as well for the correct separator being in use?

Re: Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-03-23, 12:47
by back0rifize
I saw it in the status bar, where my addon (Calendate) places current date. Moreover, I've got this issue in its main window (when 'calendate.xul' is calling). For example, here is my code:

MAIN WINDOW WITH CURRENT DATE (CALLED FROM 'calendate.core.js')

Code: Select all

var actual = 
{
	date : function ()
	{
		var dpicker = document.getElementById('calenDate-main-datepicker').value;
		var tbox = document.getElementById('calenDate-current-date');
		var today = new Date();
		today.setTime(Date.parse(dpicker));
		tbox.setAttribute('value', today.toLocaleDateString());
	}
}
CURRENT DATE IN THE STATUS BAR PANEL (CALLED FROM 'button.core.js')

Code: Select all

var notify =
{
	me: function()
	{
		// Getting formatted date
		var bar = document.getElementById('calenDate-statusbarpanel-date');
		var button = document.getElementById('calenDate-button');
		var date = new Date();
		var month = ('0' + (date.getMonth() + 1)).slice(-2);
		var day = ('0' + date.getDate()).slice(-2);
		var set = date.getFullYear() + '-' + month + '-' + day;
		date.setTime(Date.parse(set));

		// Adding current date to statusbar panel
		bar.setAttribute('label',date.toLocaleDateString());
		bar.style.fontWeight = 'bold';

//...and so on...

	}
}
What about OS: I use Win7 x64 Enterprise (about 4 years). Nothing in my OS was changed since I updated my PM from v27.1.2 to 27.2.0. Today I did a rollback to PM v27.1.1 and all got right, the separators became again "dot" instead of "slash".

Hope this information helps both of us a little bit.

PS: Right now I was checking this code in a "Simple JS Editor" (or whatever it called in PM):

Code: Select all

var date = new Date();
var month = ('0' + (date.getMonth() + 1)).slice(-2);
var day = ('0' + date.getDate()).slice(-2);
var set = date.getFullYear() + '-' + month + '-' + day;
date.setTime(Date.parse(set));
alert(date.toLocaleDateString());
and I've got the"dot"- separators. Used version: 27.1.1.

Re: Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-03-23, 15:05
by Moonchild
Hmm yeah it looks like the ICU API has changed and it's not picking up the correct separators in our js engine.
Issue #976 created.

Re: Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-04-02, 17:43
by JustOff
back0rifize wrote:It's not critical, but I would like to know the reason: maybe there was some changes in toLocaleDateString() method or it's a localization issue, or something else?
This regression was fixed in 27.3.0a1.

Re: Problem with current date displaying in PM v27.2.0 (x64)

Posted: 2017-04-02, 20:17
by back0rifize
Alrighty then! Отличненько!