﻿var JSONDate = Class.create({
    initialize: function(date) {
        if (date)
            this.setValue(date);
        else
            this.setValue(new Date());
    },
    setValue: function(date) {
        if (date) {
            this.year = date.getFullYear();
            this.month = date.getMonth() + 1;
            this.day = date.getDate();
            this.hour = date.getHours();
            this.minute = date.getMinutes();
            this.second = date.getSeconds();
        }
    },
    setDate: function(year, month, day, hour, minute, second) {
        this.year = year;
        this.month = month;
        this.day = day;
        this.hour = hour;
        this.minute = minute;
        this.second = second;
    }
});
function JSONDate_GetDate(jsonDate) {
    var val = new Date();
    val.setFullYear(jsonDate.year);
    val.setMonth(parseInt(jsonDate.month) - 1);
    val.setDate(jsonDate.day);
    val.setHours(jsonDate.hour);
    val.setMinutes(jsonDate.minute);
    val.setSeconds(jsonDate.second);
    return val;
}

