Focal Point
Calendar date format

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/2701093122

April 02, 2007, 08:32 AM
Omni
Calendar date format
fragment from my html launch page
  calendardata="0/0/-10;0/0/10" calendardatatype="1" ibiformat="YYMD"


Date picker js returns date in format 'yyyy/mm/dd'

I want date to be return in format 'yyyy mm dd'
or 'yyyy-mm-dd'

any suggestions how to make it working?


WF 7.1. Excel 2k, Excel Pivot, HTML
April 02, 2007, 09:19 AM
Alan B
Not easily. There are only a few suppoerted date formats unfortunately.

The only way is to change dyncalendar.js to create the format you want after it has created the date. Only to be attempted if you are sure of what you are doing.


Alan.
WF 7.705/8.007
April 02, 2007, 01:13 PM
Darin Lee
easiest thing to do would be to take that date and use a -SET to mask it (EDIT) into the format you need. As Alan mentions, there are only a few supported formats, so you do what you can with what you've got.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
April 03, 2007, 06:04 AM
Omni
thanks for answers, I managed to edit jscripts. However I had to edit two files not one:

dynCalendar.js
calendarInit.js

I also translated week days, months in native language.

However, I stick with only 1 date format (yyyy.mm.dd). It's a lot of work to do to change all formats in js files.

Now I just wonder how to put current date when page loads...


WF 7.1. Excel 2k, Excel Pivot, HTML
April 03, 2007, 06:37 AM
Alan B
Just use an onload function and populate with current date. Be careful that the format doesn't break the js, as it can easily do.

I normally allow the date input to be populated in the format I want, then reformat before dyncalendar gets it. Let dyncalendar create the date in a format it likes and then reformat it before putting it into the input box. This requires less work on the js.


Alan.
WF 7.705/8.007
April 03, 2007, 09:17 AM
AlexU
Accept the output from the calender to a variable and use a -SET with an EDIT and mask to convert to whatever you want as mentioned.
Looks like this:
-SET &DTB = EDIT(&DOB,'$$$$$99$$$') ||'-'|| EDIT(&DOB,'$$$$$$$$99')||'-'|| EDIT(&DOB,'9999$$$$$$');


WF 7703M, XP/Win7, MRE, RC, BID, PMF, HTML, PDF, Excel 2000/7/10
April 03, 2007, 11:53 AM
Darin Lee
This also eliminates the headache with product upgrades as well. Those JS files will get overwritten when you do any client upgrade and you have to go back and check to see if your code is still valid and then put the changes back in. Kind of a pain, speaking from experience.


Regards,

Darin



In FOCUS since 1991
WF Server: 7.7.04 on Linux and Z/OS, ReportCaster, Self-Service, MRE, Java, Flex
Data: DB2/UDB, Adabas, SQL Server Output: HTML,PDF,EXL2K/07, PS, AHTML, Flex
WF Client: 77 on Linux w/Tomcat
April 03, 2007, 12:03 PM
Alan B
I agree Darin. It is a pain to have to change any of the js files.

However, IF you really MUST change the js, keep the changes simple; my approach is, rather than add code directly to a js file, keep the new code separate and add only a call to the new code from the original js. In the case of dyncalendar.js that would be a call to reformat the date prior to dyncalendar doing any work, and a call to reformat after dyncalendar has done it's bit. That way any changes in the js by IB can be more easily dealt with.


Alan.
WF 7.705/8.007