diff --git a/extensions/community/TimestampToDate.json b/extensions/community/TimestampToDate.json new file mode 100644 index 000000000..3948eca7d --- /dev/null +++ b/extensions/community/TimestampToDate.json @@ -0,0 +1,113 @@ +{ + "author": "", + "category": "General", + "dimension": "", + "extensionNamespace": "", + "fullName": "Timestamp To Date", + "gdevelopVersion": "", + "helpPath": "", + "iconUrl": "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIiB4bWxuczp4bGluaz0iaHR0cDovL3d3dy53My5vcmcvMTk5OS94bGluayIgdmVyc2lvbj0iMS4xIiBpZD0ibWRpLWNhbGVuZGFyLW1vbnRoLW91dGxpbmUiIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij48cGF0aCBkPSJNNywxMkg5VjE0SDdWMTJNMjEsNlYyMEEyLDIgMCAwLDEgMTksMjJINUMzLjg5LDIyIDMsMjEuMSAzLDIwVjZBMiwyIDAgMCwxIDUsNEg2VjJIOFY0SDE2VjJIMThWNEgxOUEyLDIgMCAwLDEgMjEsNk01LDhIMTlWNkg1VjhNMTksMjBWMTBINVYyMEgxOU0xNSwxNFYxMkgxN1YxNEgxNU0xMSwxNFYxMkgxM1YxNEgxMU03LDE2SDlWMThIN1YxNk0xNSwxOFYxNkgxN1YxOEgxNU0xMSwxOFYxNkgxM1YxOEgxMVoiIC8+PC9zdmc+", + "name": "TimestampToDate", + "previewIconUrl": "https://asset-resources.gdevelop.io/public-resources/Icons/ae8720a35702d65786e42ee8dc49fa31eb5e0e5af6db014b3215c4063004333a_calendar-month-outline.svg", + "shortDescription": "Adds an expression that can convert UNIX timestamps into a variety of date formats.", + "version": "1.0.0", + "description": [ + "You can create a digital clock using the extension.", + "", + "The extension can be used to display dates in a scoreboard, while storing the dates in a number instead of a string.", + "", + "You can use the UNIX timestamps to indicate the end date of a timer in multiple formats." + ], + "tags": [ + "time", + "date" + ], + "authorIds": [ + "m4hBMBTUilft4s1V4FQQPakVDGx1" + ], + "dependencies": [], + "globalVariables": [], + "sceneVariables": [], + "eventsFunctions": [ + { + "description": "Converts unix timestamps into a user-readable string.", + "fullName": "Unix timestamp, converted to string", + "functionType": "StringExpression", + "name": "Date", + "sentence": "", + "events": [ + { + "type": "BuiltinCommonInstructions::JsCode", + "inlineCode": [ + "let format = eventsFunctionContext.getArgument(\"format\")", + "let unix_timestamp = eventsFunctionContext.getArgument(\"UNIX_timestamp\")", + "", + "switch(format){", + " case \"ISO\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toISOString();", + " break;", + "", + " case \"standard\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toString();", + " break;", + "", + " case \"standard date\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toDateString();", + " break;", + "", + " case \"standard time\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toTimeString();", + " break;", + " ", + " case \"locale\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toLocaleString();", + " break;", + "", + " case \"locale date\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toLocaleDateString();", + " break;", + "", + " case \"locale time\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toLocaleTimeString();", + " break;", + "", + " case \"GMT\":", + " eventsFunctionContext.returnValue = new Date(unix_timestamp).toUTCString();", + " break;", + " }" + ], + "parameterObjects": "", + "useStrict": true, + "eventsSheetExpanded": false + } + ], + "expressionType": { + "type": "string" + }, + "parameters": [ + { + "description": "UNIX timestamp", + "name": "UNIX_timestamp", + "type": "expression" + }, + { + "description": "Format", + "name": "format", + "supplementaryInformation": "[\"ISO\",\"standard\",\"standard date\",\"standard time\",\"locale\",\"locale date\",\"locale time\",\"GMT\"]", + "type": "stringWithSelector" + } + ], + "objectGroups": [] + } + ], + "eventsFunctionsFolderStructure": { + "folderName": "__ROOT", + "children": [ + { + "functionName": "Date" + } + ] + }, + "eventsBasedBehaviors": [], + "eventsBasedObjects": [] +}