Recent Topics

Issue Date format error editing post after changing locale

Started by on Feb 25, 2007 – Contents updated: Feb 25, 2007

Feb 25, 2007 17:41    

Whenever I change the date settings for the en-UK locale from the default d/m/y to jS M Y (eg "25th February 2007") it renders me unable to update a post becase it complains about the "issue date" field not being valid.

This (or something very similar) was [url=http://forums.b2evolution.net/viewtopic.php?t=9286]reported previously as a bug in 1.8.x[/url] but seems to have survived into 1.9.2

Feb 25, 2007 18:54

It's not a bug. It's just that "S" has never been supported.
I've now added this for 1.10. The patch is not difficult:

Code

--- blogs/inc/_misc/_request.class.php  30 Nov 2006 21:33:46 -0000      1.19.2.5
+++ blogs/inc/_misc/_request.class.php  25 Feb 2007 17:50:01 -0000
@@ -601,6 +601,7 @@
                                case "D": return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_abbrev"])))).")";
                                case "e": // b2evo extension!
                                        return "(".str_replace("~", "\~", implode("|", array_map("trim", array_map("T_", $GLOBALS["weekday_letter"])))).")";
+                               case "S": return "(st|nd|rd|th)"; // english suffix for day
 
                                case "m": return "([0-1]\\d)"; // month, 01-12
                                case "n": return "(1?\\d)"; // month, 1-12

and

Code

diff -u -r1.1.8.1 date.js
--- blogs/rsc/js/date.js        26 Sep 2006 21:47:33 -0000      1.1.8.1
+++ blogs/rsc/js/date.js        25 Feb 2007 17:50:00 -0000
@@ -144,6 +147,20 @@
        value["mm"]=LZ(m);
        value["s"]=s;
        value["ss"]=LZ(s);
+
+       // english ordinal numbers (see http://en.wikipedia.org/wiki/Names_of_numbers_in_English#Ordinal_numbers):
+       if( d < 20 && d > 9 )
+       {
+               value["S"] = "th";
+       }
+       else switch( d % 10 )
+       {
+               case 1: value["S"] = "st"; break;
+               case 2: value["S"] = "nd"; break;
+               case 3: value["S"] = "rd"; break;
+               default: value["S"] = "th"; break;
+       }
+
        while (i_format < format.length) {
                c=format.charAt(i_format);
                if( c == "\\" )

If you don't know how to patch those two files according to the snippets above you'll have to wait for 1.10.

Feb 25, 2007 20:47

Thanks - I'll have a look into it ASAP

Apr 21, 2007 15:48

Sorry for taking so long but I finally found time to apply the patch above (dissertations and stuff have to take precedence I'm afraid :( )

Anyway, I'm still getting a "Please enter a valid issue date" error message when I try to edit a post :(

Is it definitely only one line in the request class?

Apr 21, 2007 18:13

Please retry reproducing it at the demo site, with the CVS HEAD version. If you can reproduce it, I'll look into it again.

May 13, 2007 09:46

i changed the date format in regional settings to d F Y
then i can create a post without problems
when i go to edit it, i get the same error: "please enter a valid issue date"

May 13, 2007 09:58

the problem is in "/inc/_vars.inc.php"
on line 217 there is an extra space after may:

Code

$month['05'] = NT_('May ');

it should:

Code

$month['05'] = NT_('May');

can we get that fixed globally!?!

thanks

May 13, 2007 23:46

why does there need to be a differentiation between the short form and long form...?

why is this still an ongoing problem?
is this going to be fixed in the next release?

May 14, 2007 00:41

morphosic, "ongoing problem"?
I've just applied the fix for v-1-10, so it should be in 1.10.1.
There needs to be "May" and "May " so that translators can have short and long versions of the same month (what the comment says).

May 14, 2007 07:25

i say 'ongoing' becaues this was apparantly an issue in earlier releases... which is how i found what about the 'may ' thing...


Form is loading...

powered by b2evolution – This forum is powered by b2evolution CMS, a complete engine for your website.