I have small query in our office people are using two of regional settings on windows Operating System. Control Panel -> Regional and Languages Options 1) English(United States) 2) English ( United Kingdom)
As you are aware of the fact that this affect date and time formats, currency and number settings. My application developed in xpages creates conflicts where operating system regional settings is set to English(UK). On form submit button I get value from component and create date and time object as mentioned in below example where dateFrom is component name on xpage containing date&time control with validator and converter (dd.MM.yyyy).
When I run following code after submit button its works fine where operating systems settings are English(United States) but those clients who are using windows setting to English(United Kingdom) gets different results e.g. if one persons selects 08.09.2014 (September 08, 2014) in date from field when this code runs it creates object containing 09.08.2014 ( August 09, 2014)
var dtFrom:NotesDateTime = session.createDateTime(getComponent("dateFrom").getValue());
var weekDayStart = @Weekday(dtFrom.getDateOnly());
var weekDayEnd = @Weekday(dtTo.getDateOnly());
var warnMsg1 = viewScope.get("saturdayFlag");
if ( weekDayStart == 7 && (warnMsg1 == null || warnMsg1 == ""))
{
getComponent("warningMessage").setValue("Warning: You are going start your leave on SATURDAY. If you are OK with it than Press Submit Button.");
viewScope.put("saturdayFlag", "True");
return "Warning1";
}
I have lot of business rules dependent on this object. This thing is effecting my entire business logic and currently application is in production. Can you please look into it and let me know how handle this issue at configurations or code level. Your quick response in this regard will be highly appreciated.
Edited: Thanks for your time and efforts by understanding my pain related to this issue. Below xpage behave different on two workstations based on their regional settings because change in date format. How can I avoid Lotus Client should not take OS regional settings because this is working well on Browser.
<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">
<xp:inputText id="dateFrom" style="width:%" required="true"
disableClientSideValidation="true">
<xp:this.validators>
<xp:validateRequired message="Please select Date From">
</xp:validateRequired>
</xp:this.validators>
<xp:this.converter>
<xp:convertDateTime pattern="dd.MM.yyyy" type="date"
ignoreUserTimeZone="true" dateStyle="default" locale="en_US"
>
</xp:convertDateTime>
</xp:this.converter>
<xp:dateTimeHelper></xp:dateTimeHelper>
</xp:inputText>  
<xp:button value="Display DT Object" id="button1"><xp:eventHandler event="onclick" submit="true" refreshMode="complete">
<xp:this.action>
<xp:executeScript>
<xp:this.script><![CDATA[#{javascript:var mDt:NotesDateTime = session.createDateTime(getComponent("dateFrom").getValue());
var ni:NotesInternational = session.getInternational();
if ( ni.isDateDMY())
{
/// This Code is for English (United Kindom Settings)
DATE_FORMAT = "dd/MM/yyyy";
///getComponent("inputText3").setValue(mDt.getDateOnly());//return;
///var mDt3:Date = new Date(mDt.toJavaDate());//I18n.parseDate(@Text(mDt.getDateOnly()), DATE_FORMAT, I18n.getServerLocale() , I18n.getServerTimeZone());
///var mMonth = mDt3.getMonth() + 1;
//var mStr:string = @Text(mMonth)+"/"+mDt3.getDate()+"/"+mDt3.getFullYear();
//var mDt4:NotesDateTime = session.createDateTime(mDt.toJavaDate().getMonth()+1+"/"+mDt.toJavaDate().getDate()+"/"+mDt.toJavaDate().getFullYear());
/// var mDt4:NotesDateTime = session.createDateTime(@Text(mDt.toJavaDate()));
///getComponent("inputText5").setValue( mDt.toJavaDate().getMonth()+1+"/"+mDt.toJavaDate().getDate()+"/"+mDt.toJavaDate().getFullYear());
//mDt2:NotesDate
//getComponent("inputText5").setValue(mDt9.toJavaDate() - mDt.toJavaDate());
getComponent("inputText1").setValue(@Day(mDt.getDateOnly()));// Showing Day of Date Object;
getComponent("inputText2").setValue(@Month(mDt.getDateOnly())); // Showing Month of D ate Object
getComponent("inputText4").setValue(@Weekday(mDt.getDateOnly())); /// Showing Weekday of Date Object
}
else
{
// This Code is for English ( United States) Regional Settings at OS LEVEL
getComponent("inputText1").setValue(@Day(mDt.getDateOnly()));// Showing Day of Date Object;
getComponent("inputText2").setValue(@Month(mDt.getDateOnly())); // Showing Month of Date Object
getComponent("inputText4").setValue(@Weekday(mDt.getDateOnly())); //
}
}]]></xp:this.script>
</xp:executeScript>
</xp:this.action></xp:eventHandler></xp:button>
<xp:br></xp:br>
<xp:table>
<xp:tr>
<xp:td><xp:span style="font-weight:bold">Day is : </xp:span></xp:td>
<xp:td><xp:inputText id="inputText1" style="font-weight:bold"></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:span style="font-weight:bold">Month is :</xp:span></xp:td>
<xp:td><xp:inputText id="inputText2" style="font-weight:bold"></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:span style="font-weight:bold">weekDay </xp:span></xp:td>
<xp:td><xp:inputText id="inputText4" style="font-weight:bold"></xp:inputText></xp:td>
</xp:tr>
<xp:tr>
<xp:td><xp:span style="font-weight:bold">Zone ID :</xp:span></xp:td>
<xp:td><xp:inputText id="inputText5" style="font-weight:bold"></xp:inputText> </xp:td>
</xp:tr>
</xp:table>
</xp:view>