|
|
| version 1.99, 2015/10/26 01:21:53 | version 1.100, 2016/03/27 20:53:43 |
|---|---|
| Line 290 static void _gmt_string(Request& r, Meth | Line 290 static void _gmt_string(Request& r, Meth |
| r.write_assign_lang(*vdate.get_gmt_string()); | r.write_assign_lang(*vdate.get_gmt_string()); |
| } | } |
| static void _iso_string(Request& r, MethodParams&) { | static void _iso_string(Request& r, MethodParams& params) { |
| VDate& vdate=GET_SELF(r, VDate); | VDate& vdate=GET_SELF(r, VDate); |
| r.write_assign_lang(*vdate.get_iso_string()); | VDate::iso_string_type format=VDate::iso_string_default; |
| if(params.count()>0) | |
| if(HashStringValue* options=params.as_hash(0)){ | |
| int valid_options=0; | |
| if(Value* vshow_ms=options->get("ms")){ | |
| if(r.process_to_value(*vshow_ms).as_bool()) | |
| format=VDate::iso_string_type(format|VDate::iso_string_ms); | |
| valid_options++; | |
| } | |
| if(Value* vshow_colon=options->get("colon")){ | |
| if(!r.process_to_value(*vshow_colon).as_bool()) | |
| format=VDate::iso_string_type(format|VDate::iso_string_no_colon); | |
| valid_options++; | |
| } | |
| if(Value* vshow_z=options->get("z")){ | |
| if(!r.process_to_value(*vshow_z).as_bool()) | |
| format=VDate::iso_string_type(format|VDate::iso_string_no_z); | |
| valid_options++; | |
| } | |
| if(valid_options != options->count()) | |
| throw Exception(PARSER_RUNTIME, 0, CALLED_WITH_INVALID_OPTION); | |
| } | |
| r.write_assign_lang(*vdate.get_iso_string(format)); | |
| } | } |
| static void _roll(Request& r, MethodParams& params) { | static void _roll(Request& r, MethodParams& params) { |
| Line 519 MDate::MDate(): Methoded("date") { | Line 543 MDate::MDate(): Methoded("date") { |
| // ^date.gmt-string[] | // ^date.gmt-string[] |
| add_native_method("gmt-string", Method::CT_DYNAMIC, _gmt_string, 0, 0); | add_native_method("gmt-string", Method::CT_DYNAMIC, _gmt_string, 0, 0); |
| // ^date.iso-string[] | // ^date.iso-string[$.colon(true) $.z(true) $.ms(false)] |
| add_native_method("iso-string", Method::CT_DYNAMIC, _iso_string, 0, 0); | add_native_method("iso-string", Method::CT_DYNAMIC, _iso_string, 0, 1); |
| // ^date:lastday(year;month) | // ^date:lastday(year;month) |
| // ^date.lastday[] | // ^date.lastday[] |