loubee-anna
loubee-anna

Reputation: 23

Dijit DateTextBox set date in a year lower thatn 100

I am trying to set an really old value in a DateTextBox. Unfortunately the widget won't accept dates set in a year lower than '100'.

When I try to set the value of the element to 0017-01-01 the widget automatically sets itself to 2017-01-01.

The displayed value property keeps unchanged until the widget gets out of focus, then it is changed to the internal date.

<input type="date" 
    data-dojo-type="dijit/form/DateTextBox" 
    value='0017-01-01' 
    id="myDate" />

Is there any way to allow older dates 0100-01-01 in the DateTextBox?

I also build a small jsfiddle to demonstrate the effect: http://fiddle.jshell.net/shfe1oqs/

Upvotes: 2

Views: 234

Answers (1)

Jean-Claude Hujeux
Jean-Claude Hujeux

Reputation: 401

You can add the constraint strict == true to your DateTextBox:

<input type="date" data-dojo-type="dijit/form/DateTextBox" 
 data-dojo-props="constraints: {strict: true}" value='0017-01-01' id="myDate" />

The modified jsfiddle: http://fiddle.jshell.net/fuzxt1fb/3/

Note that then you will have to enter two digits values for day and month

Upvotes: 2

Related Questions