Parse Date Error

Module Export

You can copy and paste this module export into your scenario. This will paste the modules shown in my screenshots above.

  1. Copy the JSON code below by clicking the copy button when you mouseover the top-right of the code block
    Screenshot_2024-01-17_200117

  2. Enter your scenario editor. Press ESC to close any dialogs. Press CTRLV (paste keyboard shortcut for Windows) to paste directly in the canvas.

  3. Click on each imported module and save it for validation. You may be prompted to remap some variables and connections.

View Module Export Code

JSON

{
    "subflows": [
        {
            "flow": [
                {
                    "id": 105,
                    "module": "util:SetVariable2",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "name": "DateSubmission",
                        "scope": "roundtrip",
                        "value": "2024-05-07T12:14:31.000Z"
                    },
                    "metadata": {
                        "designer": {
                            "x": -2030,
                            "y": 291,
                            "name": "Set Date String"
                        },
                        "restore": {
                            "expect": {
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "name",
                                "type": "text",
                                "label": "Variable name",
                                "required": true
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            },
                            {
                                "name": "value",
                                "type": "any",
                                "label": "Variable value"
                            }
                        ],
                        "interface": [
                            {
                                "name": "DateSubmission",
                                "label": "DateSubmission",
                                "type": "any"
                            }
                        ]
                    }
                },
                {
                    "id": 107,
                    "module": "util:SetVariables",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "variables": [
                            {
                                "name": "ParsedDate",
                                "value": "{{parseDate(105.DateSubmission; \"YYYY-MM-DDTHH:mm:ss.SSSZ\")}}"
                            },
                            {
                                "name": "MiddleOfYear",
                                "value": "{{setSecond(setMinute(setHour(setDate(setMonth(now; 6); 30); 23); 59); 59)}}"
                            },
                            {
                                "name": "MiddleOfYearAlt",
                                "value": "{{parseDate(\"30-06-\" + formatDate(now; \"YYYY\") + \" 23:59:59\"; \"DD-MM-YYYY HH:mm:ss\")}}"
                            },
                            {
                                "name": "IsBeforeJuly",
                                "value": "{{parseDate(105.DateSubmission; \"YYYY-MM-DDTHH:mm:ss.SSSZ\") < \"\n\"}}{{parseDate(\"30-06-\" + formatDate(now; \"YYYY\") + \" 23:59:59\"; \"DD-MM-YYYY HH:mm:ss\")}}"
                            },
                            {
                                "name": "DiscountRate",
                                "value": "{{if(parseDate(105.DateSubmission; \"YYYY-MM-DDTHH:mm:ss.SSSZ\") < parseDate(\"30-06-\" + formatDate(now; \"YYYY\") + \" 23:59:59\"; \"DD-MM-YYYY HH:mm:ss\"); 25; 0)}}"
                            }
                        ],
                        "scope": "roundtrip"
                    },
                    "metadata": {
                        "designer": {
                            "x": -1785,
                            "y": 290,
                            "name": "Check if before July"
                        },
                        "restore": {
                            "expect": {
                                "variables": {
                                    "items": [
                                        null,
                                        null,
                                        null,
                                        null,
                                        null
                                    ]
                                },
                                "scope": {
                                    "label": "One cycle"
                                }
                            }
                        },
                        "expect": [
                            {
                                "name": "variables",
                                "type": "array",
                                "label": "Variables",
                                "spec": [
                                    {
                                        "name": "name",
                                        "label": "Variable name",
                                        "type": "text",
                                        "required": true
                                    },
                                    {
                                        "name": "value",
                                        "label": "Variable value",
                                        "type": "any"
                                    }
                                ]
                            },
                            {
                                "name": "scope",
                                "type": "select",
                                "label": "Variable lifetime",
                                "required": true,
                                "validate": {
                                    "enum": [
                                        "roundtrip",
                                        "execution"
                                    ]
                                }
                            }
                        ],
                        "interface": [
                            {
                                "name": "ParsedDate",
                                "label": "ParsedDate",
                                "type": "any"
                            },
                            {
                                "name": "MiddleOfYear",
                                "label": "MiddleOfYear",
                                "type": "any"
                            },
                            {
                                "name": "MiddleOfYearAlt",
                                "label": "MiddleOfYearAlt",
                                "type": "any"
                            },
                            {
                                "name": "IsBeforeJuly",
                                "label": "IsBeforeJuly",
                                "type": "any"
                            },
                            {
                                "name": "DiscountRate",
                                "label": "DiscountRate",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

Here are some useful links and guides you can use to learn more on how to use the Make platform, apps, and app modules. I found these useful when I was learning Make, and hope they might benefit you too —

General

Help Center Basics

Articles & Videos

samliewrequest private consultation

Join the Make Fans Discord server to chat with other makers!

1 Like