sys_CalendarSimple

Hi

Clicking on “Today” actually put today’s date in the textbox rather than just showing the current month.

We’ve had this request from a few clients so I thought I post on the forum.

Locate the Rhythmyx\sys_resources\js\calpopup.js file. Update the setToday function as follows

function setToday() {

    
    // SET GLOBAL DATE TO TODAY'S DATE
    //calDate = new Date();

    // SET DAY MONTH AND YEAR TO TODAY'S DATE
    //var month = calDate.getMonth();
    //var year  = calDate.getFullYear();

    // SET MONTH IN DROP-DOWN LIST
    //tDoc.calControl.month.selectedIndex = month;

    // SET YEAR VALUE
    //tDoc.calControl.year.value = year;

    // GENERATE THE CALENDAR SRC
    //calDocBottom = buildBottomCalFrame();

    // DISPLAY THE NEW CALENDAR
    //writeCalendar(calDocBottom);
    
    var date = new Date();
    var d = date.getDate();
    
    returnDate(d);
}

Of course this is the sys_resources version so to make it upgrade proof copy the control config from the sys_templates file into the rx_templates file. Then copy the calpopup.js file in a folder in rx_resources. Now reference the new js file in the rx_templates calender control. Stop and restart the service.

Cheers
James

hi jimbo

is there any documentation anywhere on formatting and extracting date parts from this control please. also can the formatting be internationalized?

this is going to be my next step in my child editor functionality.

thanks
michelle

Hi Michelle

There’s a variable in the js file:

calDateFormat = “yyyy-MM-DD”;

Just above where this is declared there are other example dates you can use. Remember if you are return a string date eg “1 May 2000” then you must change the data type of the database column.

I’ve not tried changing this to match another format as this is the universal database date format. I then format this date on the actually template itself.

You can use the standard datefield macro which has a format param:

#datefield(“mydate” “dd MMM yyyy”)

If you want to change the locale of the date then this thread explains in more detail:

http://forum.percussion.com/showthread.php?t=423&highlight=date+locale

Cheers
James

hi jimbo

i’m using rx 5.7 - do your comments still apply.

thanks
michelle

Hi Michelle

They do for the first part about the .js file

Second and third are 6.5.2 specific.

Cheers
James

Michelle,

The macro James mentioned is a Velocity macro, and Velocity is used for assembly in Rhythmyx Version 6.0 and later. In Rhythmyx Version 5.7, XSL is used for assembly.

In 5.7, use the sys_ConvertDateLocale UDF. See “Implementing Internationalized Numbers and Date Formats” on p. 19 of Internationalizing and Localizing Rhythmyx for Version 5.7.

RLJII