Compare commits

...

2 Commits

Author SHA1 Message Date
AlexandreSi
9995c5ee82 Add explanation of date accessors in long description 2022-12-05 10:10:26 +01:00
AlexandreSi
3bebc57c88 Add option to get full year 2022-12-05 09:58:44 +01:00
2 changed files with 9 additions and 5 deletions

View File

@@ -227,12 +227,14 @@ void GD_CORE_API BuiltinExtensionsImplementer::ImplementsTimeExtension(
.AddCodeOnlyParameter("currentScene", "")
.AddParameter(
"stringWithSelector",
_("Date part"),
"[\"hour\", \"min\", \"sec\", \"mon\", \"year\", \"fullyear\", "
"\"wday\", \"mday\", \"yday\", \"timestamp\"]")
.SetParameterLongDescription(
_("Hour: hour - Minutes: min - Seconds: sec - Day of month: "
"mday - Months since January: mon - Year since 1900: year - Days "
"since Sunday: wday - Days since Jan 1st: yday - Timestamp (ms): "
"timestamp\""),
"[\"hour\", \"min\", \"sec\", \"mon\", \"year\", \"wday\", \"mday\", "
"\"yday\", \"timestamp\"]");
"mday - Months since January (January being 0): mon - Year: "
"fullyear - Year since 1900: year - Days since Sunday: wday - Days "
"since Jan 1st: yday - Timestamp (ms): timestamp\""));
}
} // namespace gd

View File

@@ -221,6 +221,8 @@ namespace gdjs {
return now.getDate();
} else if (what === 'mon') {
return now.getMonth();
} else if (what === 'fullyear') {
return now.getFullYear();
} else if (what === 'year') {
//Conform to the C way of returning years.
return now.getFullYear() - 1900;