Focal Point
[CLOSED]Calendar Popup - change starting weekday from SU to MO

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

March 31, 2016, 04:45 AM
Aimar Arak
[CLOSED]Calendar Popup - change starting weekday from SU to MO
Hi,
I am using WF 8105 and want to make calendar popup more European like - starting weekdays from left with MO (Monday). Where I have to change something?

This message has been edited. Last edited by: <Emily McAllister>,


WebFOCUS 8.2.XX
March 31, 2016, 07:37 AM
MartinY
Haven't tried it myself but have you look at the computer's regional setting ?

I think that it may be related to that. So if it's the case nothing you can do since it will be displayed according to each PC setting.


WF versions : Prod 8.2.04M gen 33, Dev 8.2.04M gen 33, OS : Windows, DB : MSSQL, Outputs : HTML, Excel, PDF
In Focus since 2007
April 01, 2016, 09:03 AM
jgelona
Have you tried setting WEEKFIRST? I don't know if this affects calendar controls or not. Another option is to use a little java script date picker named pikaday. Just google it.

The WEEKFIRST parameter specifies a day of the week as the start of the week. This is used in week computations by the HDIFF, HNAME, HPART, HYYWD, and HSETPT functions, described in the Using Functions manual.

The HPART and HNAME subroutines can extract a week number from a date-time value. To determine a week number, they can use ISO 8601 standard week numbering, which defines the first week of the year as the first week in January with four or more days. Any preceding days in January belong to week 52 or 53 of the preceding year.

Depending on the value of WEEKFIRST, these functions can also define the first week of the year as the first week in January with seven days.

The WEEKFIRST parameter does not change the day of the month that corresponds to each day of the week, but only specifies which day is considered the start of the week.

The syntax is:
SET WEEKFIRST = {value|7}

where:
value
Can be:

1 through 7, representing Sunday through Saturday with non-standard week numbering.

or

ISO1 through ISO7, representing Sunday through Saturday with ISO standard week numbering.

Note: ISO is a synonym for ISO2.

The ISO standard establishes Monday as the first day of the week, so to be fully ISO compliant, the WEEKFIRST parameter should be set to ISO or ISO2.


In FOCUS since 1985. Prod WF 8.0.08 (z90/Suse Linux) DB (Oracle 11g), Self Serv, Report Caster, WebServer Intel/Linux.
April 20, 2016, 05:38 AM
Aimar Arak
My regional settings are set to English UK and that not helps.

Pikaday looks good, but can somebody help and give instructions how to get this working. Where to copy and what files(as it is not just installer you can install)?


WebFOCUS 8.2.XX
April 20, 2016, 10:05 AM
Squatch
Assuming your calendar has an ID named "calendar1", you could do this using jQuery:

//Begin function window_onload
function window_onload() {

UpdateData();
// TODO: Add your event handler code here
//add onInitialUpdate() function to make changes before initial run of the reports
var calendar_icon = $("#calendar1").nextAll("img").first().offset();
$("#calendar1").datepicker("option", "firstDay", 1);
$("#calendar1").nextAll("img").first().css("position", "absolute");
$("#calendar1").nextAll("img").first().css("left", calendar_icon.left + "px");
$("#calendar1").nextAll("img").first().css("top", calendar_icon.top + "px");
}
//End function window_onload

When your browser window loads, the code you see above placed in the "window_onload" event will change the starting day of the week to Monday. That actually happens in the "datepicker" line of code; when that line executes it resets the calendar icon so that it is positioned in the upper left corner of the window. The other lines of code reposition it next to the input box where the date shows.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
April 26, 2016, 08:30 AM
Aimar Arak
This works very well, thank you Squatch. Short, simple and elegant solution.

One more problem I have with calendar popup. I have date format DD/MM/YYYY and so it is shown in date box. For example if I choose 2nd Apr 2016 it is shown as 02/04/2016. ANd now if I open calendar popup again system interprets this date as 4th Feb 2016 and preselects this date on popup.
If I choose 15th Jan 2016 and open popup again it does not recognize this date (as there are not 15th month) and preselects current date.

How can I set the javascript calendar popup to understand that my date format is DD/MM/YYYY?
In the screenshot there was 01/04/2015 (as 1st of April 2016) and if I open a calendar popup it preselects 4th of Jan 2016.
And now if I select this date it appears in date box as 04/01/2016 (DD/MM/YYYY).

This message has been edited. Last edited by: Aimar Arak,


WebFOCUS 8.2.XX
April 26, 2016, 10:05 AM
Francis Mariani
I haven't started using App Studio yet, but it appears the GUI uses standard jQuery UI controls (if not, I apologize), so you can set the date format option. See the doc:

jQuery UI Datepicker

// Setter
$( "#calendar1" ).datepicker( "option", "dateFormat", "dd-mm-yyyy" );


(Meanwhile, I am fruitlessly trying to get the world to accept the only unambiguous date format YYYY-MM-DD...)


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 26, 2016, 01:41 PM
Squatch
I think there should only be two y's for a four-digit year:

// Setter
$( "#calendar1" ).datepicker( "option", "dateFormat", "dd-mm-yy" );

That being said, I didn't need to use that line of code. I just went to the calendar's Settings panel and changed the date format to DMYY. I'm not sure why you would be getting mixed dates like that, Aimar. Strange.


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs
April 26, 2016, 02:00 PM
Francis Mariani
I've seen the exact same behaviour on of my colleague's App Studio v8.0.08 screens...


Francis


Give me code, or give me retirement. In FOCUS since 1991

Production: WF 7.7.05M, Dev Studio, BID, MRE, WebSphere, DB2 / Test: WF 8.1.05M, App Studio, BI Portal, Report Caster, jQuery, HighCharts, Apache Tomcat, MS SQL Server
April 26, 2016, 02:25 PM
Squatch
quote:
Originally posted by Francis Mariani:
I've seen the exact same behaviour on of my colleague's App Studio v8.0.08 screens...

And Aimar is using the exact same version of WebFOCUS that I am... something for me to look forward to, I guess... *sigh*


App Studio
WebFOCUS 8.1.05M
Windows, All Outputs