trouble with validation scripts

LabKey Support Forum (Inactive)
trouble with validation scripts Ben Bimber  2010-07-08 14:53
Status: Closed
 
if i want to print a date as a string in the description field, is there an easy way to format it as 'yyyy-mm-dd' instead of the default long date string? below is the closest i came, but it seems like it should be simpler:

    dateString: function (date){
        date = new Date(date);
        return date.getFullYear()+'-'+(date.getMonth()<10 ? 0:'')+date.getMonth()+'-'+(date.getDate()<10 ? 0:'')+date.getDate();
    }