Setting an arbitrary date in Datefield

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Setting an arbitrary date in Datefield

Peter Caffin
Hi guys,

My code:

var T3205 = new qx.ui.form.DateField();
var dateFMT = new qx.util.format.DateFormat("YYYY-MM-dd");
T3205.setDateFormat(dateFMT);

How do I set that date to "1996-11-24" (November 11, 1996)?

I've tried:

T3205.setValue("1996-11-24");

The examples in the documentation use "new Date()" but don't show how
you should set a specific date.

Thanks.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting an arbitrary date in Datefield

Peter Caffin

Ah. Nevermind, I've sussed out the answer :)

T3205.getChildControl("textfield").setValue("1996-11-24");

On 6/09/2015 7:10 am, Peter Caffin wrote:

> Hi guys,
>
> My code:
>
> var T3205 = new qx.ui.form.DateField();
> var dateFMT = new qx.util.format.DateFormat("YYYY-MM-dd");
> T3205.setDateFormat(dateFMT);
>
> How do I set that date to "1996-11-24" (November 11, 1996)?
>
> I've tried:
>
> T3205.setValue("1996-11-24");
>
> The examples in the documentation use "new Date()" but don't show how
> you should set a specific date.
>
> Thanks.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting an arbitrary date in Datefield

Gerald Lo
Hi,

You may use "setValue" with a native javascript Date object

e.g.
var jsDate = new Date(1996, 10, 24); (create a Date object with date "1996-11-24")
T3205.setValue(jsDate);

Gerald



Peter Caffin wrote
Ah. Nevermind, I've sussed out the answer :)

T3205.getChildControl("textfield").setValue("1996-11-24");

On 6/09/2015 7:10 am, Peter Caffin wrote:
> Hi guys,
>
> My code:
>
> var T3205 = new qx.ui.form.DateField();
> var dateFMT = new qx.util.format.DateFormat("YYYY-MM-dd");
> T3205.setDateFormat(dateFMT);
>
> How do I set that date to "1996-11-24" (November 11, 1996)?
>
> I've tried:
>
> T3205.setValue("1996-11-24");
>
> The examples in the documentation use "new Date()" but don't show how
> you should set a specific date.
>
> Thanks.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: Setting an arbitrary date in Datefield

Gerald Lo
In reply to this post by Peter Caffin
For more info:

writing to the child control of the DateField is fine,
but you have to make sure the input string format matches the DateFormat.

so i recommend to use "setValue" of DateField, with native Date object
and let the DateField widget to take care the display itself.

Hope this helps.


Peter Caffin wrote
Ah. Nevermind, I've sussed out the answer :)

T3205.getChildControl("textfield").setValue("1996-11-24");

On 6/09/2015 7:10 am, Peter Caffin wrote:
> Hi guys,
>
> My code:
>
> var T3205 = new qx.ui.form.DateField();
> var dateFMT = new qx.util.format.DateFormat("YYYY-MM-dd");
> T3205.setDateFormat(dateFMT);
>
> How do I set that date to "1996-11-24" (November 11, 1996)?
>
> I've tried:
>
> T3205.setValue("1996-11-24");
>
> The examples in the documentation use "new Date()" but don't show how
> you should set a specific date.
>
> Thanks.

------------------------------------------------------------------------------
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel