1
Reintjan
Help needed changing calendarscript
  • 2008/2/5 15:26

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


When a module uses the calendarscript included in XOOPS the date is displayed as year, month, day.

For instance the news module uses this, you can select a date for publishing and date is displayed as told above.

Now I changed in calendarjs.php the following lines:

// date formats

Calendar._TT["DEF_DATE_FORMAT"] = "y-mm-dd";

Calendar._TT["TT_DATE_FORMAT"] = "y-mm-dd";


I changed these lines to y-dd-mm and this results in display of date to 2008-05-02 instead of standard 2008-02-05

But now the problem, by doing this the calendarscript now comes up with the month 05 instead of 02 so you have to scroll back 3 months. I thought if I change date display then the script would pick up properly.

Anyone konws how to solve this?
Be smart, stay smart. Stay one step ahead...

2
stefan88
Re: Help needed changing calendarscript
  • 2008/2/5 18:05

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


Hi,

check in ROOT/language/YOUR_LANGUAGE/global.php
i.e. (language/english/global.php)

define("_DATESTRING","Y/n/j G:i:s");
define("_MEDIUMDATESTRING","Y/n/j G:i");
define("_SHORTDATESTRING","Y/n/j");
/*
The following characters are recognized in the format string:
a - "am" or "pm"
A - "AM" or "PM"
d - day of the month, 2 digits with leading zeros; i.e. "01" to "31"
D - day of the week, textual, 3 letters; i.e. "Fri"
F - month, textual, long; i.e. "January"
h - hour, 12-hour format; i.e. "01" to "12"
H - hour, 24-hour format; i.e. "00" to "23"
g - hour, 12-hour format without leading zeros; i.e. "1" to "12"
G - hour, 24-hour format without leading zeros; i.e. "0" to "23"
i - minutes; i.e. "00" to "59"
j - day of the month without leading zeros; i.e. "1" to "31"
l (lowercase 'L') - day of the week, textual, long; i.e. "Friday"
L - boolean for whether it is a leap year; i.e. "0" or "1"
m - month; i.e. "01" to "12"
n - month without leading zeros; i.e. "1" to "12"
M - month, textual, 3 letters; i.e. "Jan"
s - seconds; i.e. "00" to "59"
S - English ordinal suffix, textual, 2 characters; i.e. "th", "nd"
t - number of days in the given month; i.e. "28" to "31"
T - Timezone setting of this machine; i.e. "MDT"
U - seconds since the epoch
w - day of the week, numeric, i.e. "0" (Sunday) to "6" (Saturday)
Y - year, 4 digits; i.e. "1999"
y - year, 2 digits; i.e. "99"
z - day of the year; i.e. "0" to "365"
Z - timezone offset in seconds (i.e. "-43200" to "43200")
*/


..

3
Reintjan
Re: Help needed changing calendarscript
  • 2008/2/7 11:13

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


It's not in global.php It has something to do with calendar.js script not rendering correct when calendarjs.php date is modified. When I change dateformat from y-mm-dd to dd-mm-y the calendar comes up whith july 2000 instead of februari 2008.

This is a problem posting news and setting date of publish, but it's in all modules using calendar.js for selecting a date.

See also example:

Click here for example...
Be smart, stay smart. Stay one step ahead...

4
Reintjan
Re: Help needed changing calendarscript
  • 2008/2/11 13:09

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Anyone?
Be smart, stay smart. Stay one step ahead...

5
Anonymous
Re: Help needed changing calendarscript
  • 2008/2/11 14:00

  • Anonymous

  • Posts: 0

  • Since:


Quote:
Reintjan wrote:

Anyone?


Stefan88 gave the correct answer. I've never heard of anyone having to alter the .js file.

6
stefan88
Re: Help needed changing calendarscript
  • 2008/2/11 14:55

  • stefan88

  • Community Support Member

  • Posts: 1086

  • Since: 2004/9/20


BTW, check also the module itself - some modules have their own date format settings in module preferences
..

7
Reintjan
Re: Help needed changing calendarscript
  • 2008/2/12 9:44

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Thanks for your replies, still the same problem. I set the date in global.php and in news module preferences to display day-month-year (4 digits...) still the date selector comes up with year-month-day. This must be a problem of calendar.js it can't be anything else....

I hope someone knows how to solve this....
Be smart, stay smart. Stay one step ahead...

8
Anonymous
Re: Help needed changing calendarscript
  • 2008/2/12 9:59

  • Anonymous

  • Posts: 0

  • Since:


Quote:
Reintjan wrote:

I hope someone knows how to solve this....


Yes!!

Upload a backup copy of calendar.js in case it's FUBAR after your editing, then.....

Change lines 164-166 of /language/english*/global.php (* or your own language) to these:

define("_DATESTRING","d/m/Y G:i:s");
define("_MEDIUMDATESTRING","d/m/Y G:i");
define("_SHORTDATESTRING","d/m/Y");


This will display the date in this format: dd/mm/yyyy 23:59:59 (e.g. 01/02/2008 15:13:45 is 13min 45sec past 3pm on 1st Feb 2008)

If you want different formats then see the (commented out) php date format codes on the lines underneath these in global.php

The News module uses the date format from global.php so no need to set it differently in the modules preferences; leave that entry blank.

The only module I had problems setting the date format was wiwimod, and that involved editing one or two of the module's php files.

If this doesn't work then I'm beginning to think that by altering calendar.js you have changed the format that dates already entered have been written to the database.

9
Reintjan
Re: Help needed changing calendarscript
  • 2008/3/4 15:23

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Thanks for your answer John....

But this doesn't solve the case.... The calendar date selector still comes up with year - month - day (see also screenprint....) Whatever variable I change....

It must be somewhere in the javascript.... But I don't know where....

Anyone, please....
Be smart, stay smart. Stay one step ahead...

10
Reintjan
Re: Help needed changing calendarscript
  • 2008/3/6 10:12

  • Reintjan

  • Not too shy to talk

  • Posts: 144

  • Since: 2005/3/17


Ok, I did find the problem... Going to close this topic because it's in the XOOPS core and report it as a bug!

See this topic:

Click here
Be smart, stay smart. Stay one step ahead...

Login

Who's Online

114 user(s) are online (64 user(s) are browsing Support Forums)


Members: 0


Guests: 114


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits