PDA

View Full Version : Simple DATE cuestion...



genius551v
25 Oct 2006, 4:36 PM
Hi,

PLz gime a hand...


i have this

my xml:

<catalog>
<coleccion>
<col0>1</col0>
<col1>INICIO DE ANO 2006</col1>
<col2>2006-08-24</col2> <--------DATE
<col3>2006-10-24</col3>
<col4>Inicio de ano del 2006</col4>
<col5>1</col5>
</coleccion>

my js:

header: "Fecha Inicio",
width: 160,
renderer: formatDate, <-----FILTRO
editor: new yg.DateEditor({
format: 'Y-m-d'
})
}

my FILTRO in js

var formatDate = function(value){
return value.dateFormat('Y-m-d');
};

dont work :-(

someone can tell me something????

TNKS

jack.slocum
25 Oct 2006, 5:02 PM
You will need to add a preprocessor to your data model to parse the incoming XML date.

Take a look at the Ajax feed viewer, I do it there.

genius551v
26 Oct 2006, 7:18 AM
ok, i add this:


dm.addPreprocessor(2, parseDate);

parseDate is:


var parseDate = function(value){
alert('parseDate: '+value);
alert('parseDate2: '+Date.parse(value));
return new Date(Date.parse(value));
};

value = 2006-08-24
Date.parse(value) =NaN ????

que significa esto? que puedo hacer?

una luz por favor...

Tnks

genius551v
26 Oct 2006, 8:01 AM
ok,


var parseDate = function(value){
value = value.replace('-','/');
value = value.replace('-','/');
return new Date(Date.parse(value));

now work!

jack.slocum
26 Oct 2006, 8:11 AM
You could also do:



var parseDate = function(value){
return Date.parseDate(value, 'Y-m-d');
}