Search code examples
xpagesconvertersdatetimepickerdatetime-format

Why component from Xpages Extension lib doesn't support converter


My xpage is using xe:djDateTextBox (bellow):

<xe:djDateTextBox id="djDateCreatedFrom"
                    value="#{compositeData.archiveDocument.entryDateFrom.time}"
                    title="#{javascript:languageGetLabelName('_arch_from_date')}"
                    style="width:49%;" showReadonlyAsDisabled="true"
                    readOnly="#{javascript:!compositeData.editMode}">
                    <xe:this.converter>
                        <xp:convertDateTime>
                            <xp:this.pattern><![CDATA[${javascript:"dd.MM.yyyy"}]]></xp:this.pattern>
                        </xp:convertDateTime>
                    </xe:this.converter>

public class ArchiveDocument extends Param{

/**
 * 
 */
private Calendar entryDateFrom;

public ArchiveDocument() {
    super();
    entryDateFrom = Calendar.getInstance();}
public Calendar getEntryDateFrom() {
    return entryDate;
}




public void setEntryDateFrom(Calendar entryDate) {
    this.entryDate = entryDate;
}

..... }

If I set standard date time picker instead of xe:djDateTextBox everything works fine: (bellow)

<xp:inputText id="txtDateCreatedFrom"
                    style="width:75.0%"
                    value="#{compositeData.archiveDocument.entryDateFrom.time}"
                    readonly="#{javascript:!compositeData.visible}"
                    dojoType="dijit.form.DateTextBox">
                    <xp:this.converter>
                        <xp:convertDateTime>
                            <xp:this.pattern><![CDATA[${javascript:"dd.MM.yyyy"}]]></xp:this.pattern>
                        </xp:convertDateTime>
                    </xp:this.converter>
                    <xp:dateTimeHelper></xp:dateTimeHelper>
                </xp:inputText>

Settings for IE, Domino server, pattern in xpage:


My IE settings for languages: English (United STates) [en-US]
Pattern:"dd.MM.yyyy"
Domino server 9.0.1 FP2
Web User Preferences: Default regional locale: Server locale


My page doesn't show date time like 27.11.2014 as it should.
It show date time like 11/27/2014.

If I'm using standard date time picker everything works fine.

Thanks in advance!


Solution

  • Is your page displaying a pre-saved value or is it just defaulting to the current date? If the former, you may be misunderstanding what the converter does.

    The job of the converter is to convert the server-side date/time value to a text string and vice versa. The converter code all runs server-side, so if there's not a pre-existing value, it will just pass a blank string. So the converter is not the place to look to modify the format the browser offers, Dojo will be defining the value.

    The Dojo locale settings will be what is being used for the date time format being used for a default value or entered on the browser. I'm not sure if this will help explain dates and localization http://xomino.com/2014/01/14/dealing-with-dates-and-localization-in-xpages/