--- parser3/src/classes/date.C 2012/03/16 09:24:06 1.91 +++ parser3/src/classes/date.C 2015/04/08 18:08:52 1.93 @@ -13,7 +13,7 @@ #include "pa_vdate.h" #include "pa_vtable.h" -volatile const char * IDENT_DATE_C="$Id: date.C,v 1.91 2012/03/16 09:24:06 moko Exp $" IDENT_PA_VDATE_H; +volatile const char * IDENT_DATE_C="$Id: date.C,v 1.93 2015/04/08 18:08:52 moko Exp $" IDENT_PA_VDATE_H; // class @@ -112,7 +112,7 @@ static int to_tm_year(int iyear) { tm tmIn; memset(&tmIn, 0, sizeof(tmIn)); tmIn.tm_isdst=-1; - if(!month) + if(!month) { if(min) { year=mday=0; // HH:MM time_t t=time(0); @@ -122,7 +122,8 @@ static int to_tm_year(int iyear) { tmIn.tm_mday=tmNow->tm_mday; goto date_part_set; } else - hour=min=sec=msec=0; // not YYYY- & not HH: = just YYYY + hour=min=sec=msec=0; // not YYYY- & not HH: = just YYYY + } tmIn.tm_year=to_tm_year(pa_atoi(year)); tmIn.tm_mon=month?pa_atoi(month)-1:0; tmIn.tm_mday=mday?pa_atoi(mday):1; @@ -138,8 +139,8 @@ static void _create(Request& r, MethodPa VDate& vdate=GET_SELF(r, VDate); if(params.count()==1){ - if(const String* sdate=params[0].get_string()){ // ^create[2002-04-25 18:14:00] ^create[18:14:00] - vdate.set_time(cstr_to_time_t(sdate->cstrm())); + if(params[0].is_string()){ // ^create[2002-04-25 18:14:00] ^create[18:14:00] + vdate.set_time(cstr_to_time_t(params[0].get_string()->cstrm())); } else { // ^create(float days) or ^create[date object] time_t t=(time_t)round(params.as_double(0, "float days must be double", r)*SECS_PER_DAY); if(t<0 || !localtime(&t))