Hello,

here is the example, i try 2000-01-01 . The same probleme but 1 year more i get on 2002-12-31

2000-01-01 = 1999-01-01

2002-12-31 = 2003-12-31

?!? Why?


http://demo.qooxdoo.org/current/playground/#%7B%22code%22%3A%20%22qx.Class.define%28%2522sakDate%2522%252C%2520%257B%250A%2520%2520extend%2520%253A%2520qx.ui.table.cellrenderer.Date%252C%250A%2520%2520%2520%2520members%2520%253A%2520%257B%250A%2520%2520%2520%2520%2509_getContentHtml%2520%253A%2520function%28cellInfo%29%257B%250A%2520%2520%2520%2520%2520%2520%2509%2509var%2520df%2520%253D%2520this.getDateFormat%28%29%253B%250A%2520%2520%2520%2520%2520%2520%2509%2509if%2520%28df%29%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509if%2520%28cellInfo.value%29%2520%257B%250A%2509%2509%2509%2509%2509if%28cellInfo.value.length%2520%253D%253D%252010%29%2520%257B%250A%2509%2509%2509%2509%2509%2509var%2520el%252Cel1%252Cel2%2520%253D%2520%255B%255D%253B%250A%2509%2509%2509%2509%2509%2509el%2520%253D%2520cellInfo.value.split%28%2522%2520%2522%29%253B%250A%2509%2509%2509%2509%2509%2509var%2520el1%2520%253D%2520el%255B0%255D.split%28%2522-%2522%29%253B%250A%2509%2509%2509%2509%2509%2509var%2520datum%2520%253D%2520new%2520Date%28el1%255B0%255D%252C%28el1%255B1%255D-1%29%252Cel1%255B2%255D%252C0%252C0%252C0%29%253B%250A%2509%2509%2509%2509%2509%2509cellInfo.value%2520%253D%2520datum%253B%250A%2509%2509%2509%2509%2509%2509%257D%250A%2509%2509%2509%2509%2509else%2520if%28cellInfo.value.length%2520%253D%253D%252019%29%2520%257B%250A%2509%2509%2509%2509%2509%2509var%2520el%252Cel1%252Cel2%2520%253D%2520%255B%255D%253B%250A%2509%2509%2509%2509%2509%2509el%2520%253D%2520cellInfo.value.split%28%2522%2520%2522%29%253B%250A%2509%2509%2509%2509%2509%2509var%2520el1%2520%253D%2520el%255B0%255D.split%28%2522-%2522%29%253B%250A%2509%2509%2509%2509%2509%2509var%2520el2%2520%253D%2520el%255B1%255D.split%28%2522%253A%2522%29%253B%250A%2509%2509%2509%2509%2509%2509var%2520datum%2520%253D%2520new%2520Date%28el1%255B0%255D%252C%28el1%255B1%255D-1%29%252Cel1%255B2%255D%252Cel2%255B0%255D%252Cel2%255B1%255D%252Cel2%255B2%255D%29%253B%250A%2509%2509%2509%2509%2509%2509cellInfo.value%2520%253D%2520datum%253B%250A%2509%2509%2509%2509%2509%2509%257D%250A%2509%2509%2509%2509%2509else%2520%257B%250A%2509%2509%2509%2509%2509%2509return%2520%2522%2522%253B%250A%2509%2509%2509%2509%2509%2509%257D%250A%2509%2509%2509%2509%2509%250A%252F%252Falert%28cellInfo.value%2520%252B%2520%2522%2520-%253E%2520%2522%2520%252B%2520df.format%28cellInfo.value%29%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509%2509return%2520qx.bom.String.escape%28df.format%28cellInfo.value%29%29%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509%257D%2520else%2520%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509%2509return%2520%2522%2522%253B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509%2509%257D%250A%2520%2520%2520%2520%2520%2520%2509%2509%2509%257D%250A%2520%2520%2520%2520%2520%2520%2509%2509else%257B%250A%2520%2520%2520%2520%2520%2520%2520%2520%2509%2509return%2520cellInfo.value%2520%257C%257C%2520%2522%2522%253B%250A%2520%2520%2520%2520%2520%2520%2509%2509%2509%257D%250A%2520%2520%2520%2520%2509%2509%257D%250A%2520%2520%2509%2509%257D%250A%2520%2520%2509%257D%29%253B%250A%250A%250A%250A%250A%250Afunction%2520createRandomRows%28rowCount%29%2520%257B%250A%2520%2520var%2520rowData%2520%253D%2520%255B%255D%253B%250A%2520%2520var%2520now%2520%253D%2520new%2520Date%28%29.getTime%28%29%253B%250A%2520%2520var%2520dateRange%2520%253D%2520400%2520*%252024%2520*%252060%2520*%252060%2520*%25201000%253B%2520%252F%252F%2520400%2520days%250A%2520%2520var%2520nextId%2520%253D%25200%253B%250A%2520%2520for%2520%28var%2520row%2520%253D%25200%253B%2520row%2520%253C%2520rowCount%253B%2520row%252B%252B%29%2520%257B%250A%2520%2520%2520%2520var%2520date%2520%253D%2520new%2520Date%282000%252C1%252C1%29%253B%250A%2520%2520%2520%2520var%2520dateString%2520%253D%2520date.getFullYear%28%29%2520%252B%2520%2522-%2522%2520%252B%2520%28date.getMonth%28%29%252B1%29%2520%252B%2520%2522-%2522%2520%252B%2520date.getDate%28%29%253B%250A%2520%2520%2520%2520dateString%2520%253D%2520%25222000-01-01%2522%253B%250A%2520%2520%2520%2520rowData.push%28%255B%2520nextId%252B%252B%252C%2520Math.random%28%29%2520*%252010000%252C%2520dateString%2520%252C%2520%28Math.random%28%29%2520%253E%25200.5%29%2520%255D%29%253B%250A%2520%2520%257D%250A%2520%2520return%2520rowData%253B%250A%257D%250A%250A%250A%252F%252F%2520window%250Avar%2520win%2520%253D%2520new%2520qx.ui.window.Window%28%2522Table%2522%29.set%28%257B%250A%2520%2520layout%2520%253A%2520new%2520qx.ui.layout.Grow%28%29%252C%250A%2520%2520allowClose%253A%2520false%252C%250A%2520%2520allowMinimize%253A%2520false%252C%250A%2520%2520contentPadding%253A%25200%250A%257D%29%253B%250Athis.getRoot%28%29.add%28win%29%253B%250Awin.moveTo%2830%252C%252040%29%253B%250Awin.open%28%29%253B%250A%250A%252F%252F%2520table%2520model%250Avar%2520tableModel%2520%253D%2520new%2520qx.ui.table.model.Simple%28%29%253B%250AtableModel.setColumns%28%255B%2520%2522ID%2522%252C%2520%2522A%2520number%2522%252C%2520%2522A%2520date%2522%252C%2520%2522Boolean%2522%2520%255D%29%253B%250AtableModel.setData%28createRandomRows%2810%29%29%253B%250A%250A%252F%252F%2520make%2520second%2520column%2520editable%250AtableModel.setColumnEditable%281%252C%2520true%29%253B%250A%250A%252F%252F%2520table%250Avar%2520table%2520%253D%2520new%2520qx.ui.table.Table%28tableModel%29.set%28%257B%250A%2520%2520decorator%253A%2520null%250A%257D%29%253B%250Awin.add%28table%29%253B%250A%250Avar%2520tcm%2520%253D%2520table.getTableColumnModel%28%29%253B%250A%250A%252F%252F%2520Display%2520a%2520checkbox%2520in%2520column%25203%250Atcm.setDataCellRenderer%283%252C%2520new%2520qx.ui.table.cellrenderer.Boolean%28%29%29%253B%250A%250A%252F*%250Avar%2520dateRenderer%2520%253D%2520%2520new%2520sakDate%28%29%253B%250AdateRenderer.setIncommingDateFormat%28new%2520qx.util.format.DateFormat%28%2522yyyy-MM-dd%2522%29%29%253B%250AdateRenderer.setDateFormat%28new%2520qx.util.format.DateFormat%28qx.locale.Date.getDateFormat%28%2522medium%2522%29.toString%28%29%29%29%253B%250A%2520%2520tcm.setDataCellRenderer%282%252C%2520dateRenderer%29%253B%250A*%252F%250A%250Avar%2520format%2520%253D%2520new%2520sakDate%28%29%253B%250Aformat.setDateFormat%28new%2520qx.util.format.DateFormat%28%2522dd.MM.YYYY%2522%29%29%253B%250Atcm.setDataCellRenderer%282%252C%2520format%29%253B%250A%2509%2509%2509%2509%2509%2509%2509%250A%252F%252F%2520use%2520a%2520different%2520header%2520renderer%250Atcm.setHeaderCellRenderer%282%252C%2520new%2520qx.ui.table.headerrenderer.Icon%28%2522icon%252F16%252Fapps%252Foffice-calendar.png%2522%252C%2520%2522A%2520date%2522%29%29%253B%250A%250A%22%7D


Hi,

Please provide a working playground example, so that we can have a look on it.

Tino


Am 05.09.2011 um 14:15 schrieb smisobnline:

Hello,

i create my own class , based upon the date classf rom qooxdoo. i only
change the  format of teh given date to  transfer mysql ateformat. See
code below


some date strings i give

2002-12-31
2000-01-01

result in wrong  values. Sometimes it gives a year more back and
sometimes a year less

2000-01-01 = 1.1.1999
2002-12-31 = 31.1.2003

is this a  bug inside the date format clas from qooxdoo?

What can i be?






qx.Class.define("makebiz.system.ui.table.cellrenderer.Date", {
    extend : qx.ui.table.cellrenderer.Date,
      members : {
        _getContentHtml : function(cellInfo){
              var df = this.getDateFormat();
              if (df){
                if (cellInfo.value) {
                    if(cellInfo.value.length == 10) {
                        var el,el1,el2 = [];
                        el = cellInfo.value.split(" ");
                        var el1 = el[0].split("-");
                        var datum = new
Date(el1[0],(el1[1]-1),el1[2],0,0,0);
                        cellInfo.value = datum;
                        }
                    else if(cellInfo.value.length == 19) {
                        var el,el1,el2 = [];
                        el = cellInfo.value.split(" ");
                        var el1 = el[0].split("-");
                        var el2 = el[1].split(":");
                        var datum = new
Date(el1[0],(el1[1]-1),el1[2],el2[0],el2[1],el2[2]);
                        cellInfo.value = datum;
                        }
                    else {
                        return "";
                        }

//alert(cellInfo.value + " -> " + df.format(cellInfo.value));
                      return
qx.bom.String.escape(df.format(cellInfo.value));
                } else {
                      return "";
                    }
                  }
              else{
                return cellInfo.value || "";
                  }
            }
          }
      });

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Tino Butz
Mobile Architect

1&1 Internet AG - Web Technologies
Ernst-Frey-Straße 9 · DE-76135 Karlsruhe
Telefon: +49 721 91374-4488
tino.b...@1und1.de <mailto:tino.b...@1und1.de>

Amtsgericht Montabaur / HRB 6484
Vorstände: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Robert Hoffmann, Markus Huhn, Hans-Henning Kettler, Dr. Oliver Mauss, Jan Oetjen
Aufsichtsratsvorsitzender: Michael Scheeren



------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev


_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Special Offer -- Download ArcSight Logger for FREE!
Finally, a world-class log management solution at an even better 
price-free! And you'll get a free "Love Thy Logs" t-shirt when you
download Logger. Secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsisghtdev2dev
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to