mirror of
https://github.com/amyinspace/MagicSetEditor2.git
synced 2026-06-10 04:57:00 -04:00
Script: to_date accepts "now" as an argument
indentation fix
This commit is contained in:
committed by
Brendan Hagan
parent
46ab8870d1
commit
d1bac74eb9
@@ -14,6 +14,8 @@ Convert a string value to a [[type:date]].
|
|||||||
--Examples--
|
--Examples--
|
||||||
> to_date("2008-12-31 23:59:59")
|
> to_date("2008-12-31 23:59:59")
|
||||||
> to_date("today midnight")
|
> to_date("today midnight")
|
||||||
|
> to_date("today noon")
|
||||||
|
> to_date("now")
|
||||||
|
|
||||||
--See also--
|
--See also--
|
||||||
| [[fun:to_string]] Convert dates to strings
|
| [[fun:to_string]] Convert dates to strings
|
||||||
|
|||||||
@@ -216,9 +216,16 @@ SCRIPT_FUNCTION(to_color) {
|
|||||||
|
|
||||||
SCRIPT_FUNCTION(to_date) {
|
SCRIPT_FUNCTION(to_date) {
|
||||||
try {
|
try {
|
||||||
SCRIPT_PARAM_C(wxDateTime, input);
|
SCRIPT_PARAM_C(String, input);
|
||||||
SCRIPT_RETURN(input);
|
if (input == "now") {
|
||||||
} catch (const ScriptError& e) {
|
SCRIPT_RETURN(wxDateTime::Now());
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
SCRIPT_PARAM_C(wxDateTime, input);
|
||||||
|
SCRIPT_RETURN(input);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (const ScriptError& e) {
|
||||||
return delay_error(e);
|
return delay_error(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user