DateField beginning/end of year problem

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

DateField beginning/end of year problem

mario_qooxdoo
This post has NOT been accepted by the mailing list yet.
I'm using two DateField widget in a window.
I retrieve the information this way:

             var format = new  qx.util.format.DateFormat("YYYY-MM-dd");
             var cible1 = format.format(dateField1.getValue());
             var cible2 = format.format(dateField2.getValue());

The widget work fine except when I used January 1st or December 31st as target date for any year.
For exemple, 31 déc. 2013 (the software is in french) gives me 2014-12-31 as the result of getValue().
Is this a bug or am I doing something wrong?


Mario Elward
Aedhelweard Technologies
Reply | Threaded
Open this post in threaded view
|

Re: DateField beginning/end of year problem

slah
Any playground sample please?
Reply | Threaded
Open this post in threaded view
|

Re: DateField beginning/end of year problem

mario_qooxdoo
This post has NOT been accepted by the mailing list yet.
Hi,

Put the example under Datefield.
You just put the first datefield to Jan 1 2013 and the second datefield to Dec 31 2013.
Press Ok and the first date is good but the second is transfered as Dec 31 2014.

Mario Elward

 

----- Original Message -----

From: slah [via qooxdoo]

Sent: 04/24/13 08:55 PM

To: mario_qooxdoo

Subject: Re: DateField beginning/end of year problem

 

Any playground sample please?
 


If you reply to this email, your message will be added to the discussion below:
http://qooxdoo.678.n2.nabble.com/DateField-beginning-end-of-year-problem-tp7583355p7583356.html
To unsubscribe from DateField beginning/end of year problem, click here.
NAML

 

Reply | Threaded
Open this post in threaded view
|

Re: DateField beginning/end of year problem

mario_qooxdoo
In reply to this post by mario_qooxdoo
Here is the playground example:

    var container0 = new qx.ui.container.Composite(new qx.ui.layout.VBox(3)).set({
        padding : 5,
        decorator : null
      });<br>
<br>
    var container1 = new qx.ui.container.Composite(new qx.ui.layout.HBox(2)).set({
        padding : 5,
        decorator : null
      });<br>
    var label1 = new qx.ui.basic.Label("Date du début de la période:");<br>
    container1.add(label1);<br>
    container1.add(new qx.ui.core.Spacer(10, 0));<br>
    var dateField1 = new qx.ui.form.DateField();<br>
    container1.add(dateField1);<br>
    dateField1.setValue(new Date());<br>
   
    var container2 = new qx.ui.container.Composite(new qx.ui.layout.HBox(2)).set({
        padding : 5,
        decorator : null
      });<br>
    var label2 = new qx.ui.basic.Label("Date de la fin de la période:");<br>
    container2.add(label2);<br>
    container2.add(new qx.ui.core.Spacer(10, 0));<br>
    var dateField2 = new qx.ui.form.DateField();<br>
    container2.add(dateField2);<br>
    dateField2.setValue(new Date());<br>
 
    var btnOK = new qx.ui.form.Button("OK").set({
        paddingLeft: 50,
        paddingRight: 50
    });
<br>
    btnOK.addListener("execute", function()<br>
    {
        var format = new  qx.util.format.DateFormat("YYYY-MM-dd");<br>
        var cible1 = format.format(dateField1.getValue());<br>
        var cible2 = format.format(dateField2.getValue());<br>
        alert(cible1);<br>
        alert(cible2);<br>
    }, this);<br>
<br>
    this.getRoot().add(container0);<br>
    container0.add(container1);<br>
    container0.add(container2);<br>
    container0.add(btnOK);<br>

If you choose dec 31 2013 it gives you dec 31 2014

Mario