parseDate does not work for German Month names of March/May/October/December

Hi there,
I have a scenario where I fetch this text containing a city and a date in a text format, for example:
“Raum Hamburg - Montag, 01. Januar 2024”.
With this formula, I want to substring, then parse, then format the date:

{{formatDate(parseDate(substring(3.Variable; indexOf(3.Variable; ", ") + 2; length(3.Variable)); “DD. MMMM YYYY”; “Europe/Berlin”); “DD.MM.YYYY”; “Europe/Berlin”)}}

This formula works perfectly fine for all months except März (March), Mai (May), Oktober (October), Dezember (December).
The error says:
Failed to map ‘0.value’: Function ‘formatDate’ finished with error! Function ‘parseDate’ finished with error! ‘01. Oktober 2024’ is not a valid date or does not match the date format.

When using the English month name, it also works perfectly fine.

Is it really that the German “MMMM” parse token is not translated correctly in make.com?

Best regards

Welcome to the Make community!

I suggest translating the date string to English first.

You should be able to do it inline using eight nested replace functions to replace the month names, before the parseDate function.

e.g.:

{{replace(replace(replace(replace(replace(replace(replace(replace(3.Variable;"Januar";"January");"Februar";"February");"März";"March");"Mai";"May");"Juni";"June");"Juli";"July");"Oktober";"October");"Dezember";"December")}}

Screenshot_2024-06-03_230611

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": 54,
                    "module": "util:ComposeTransformer",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "value": "Raum Hamburg - Montag, 01. März 2024"
                    },
                    "metadata": {
                        "designer": {
                            "x": -728,
                            "y": -1453
                        },
                        "restore": {},
                        "expect": [
                            {
                                "name": "value",
                                "type": "text",
                                "label": "Text"
                            }
                        ]
                    }
                },
                {
                    "id": 56,
                    "module": "util:SetVariables",
                    "version": 1,
                    "parameters": {},
                    "mapper": {
                        "variables": [
                            {
                                "name": "date",
                                "value": "{{parseDate(replace(replace(replace(replace(replace(replace(replace(replace(trim(last(split(54.value; \",\"))); \"Januar\"; \"January\"); \"Februar\"; \"February\"); \"März\"; \"March\"); \"Mai\"; \"May\"); \"Juni\"; \"June\"); \"Juli\"; \"July\"); \"Oktober\"; \"October\"); \"Dezember\"; \"December\"); \"DD. MMMM YYYY\")}}"
                            }
                        ],
                        "scope": "roundtrip"
                    },
                    "metadata": {
                        "designer": {
                            "x": -486,
                            "y": -1449
                        },
                        "restore": {
                            "expect": {
                                "variables": {
                                    "items": [
                                        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": "date",
                                "label": "date",
                                "type": "any"
                            }
                        ]
                    }
                }
            ]
        }
    ],
    "metadata": {
        "version": 1
    }
}

samliewrequest private consultation

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

2 Likes

The make support team explained to me that the parseDate function parses the first 3 letters for the month. The 3 letters of the non-problematic months matched perfectly with the German months, which is not the case for the others. The module worked perfectly with the replace functions in it! Thank you.

2 Likes

Hey there @joel.schmitt :wave:

Just wanted to step in and thank you for sharing the details from our Support team that solved your issue. This way other members can use this info while dealing with similar problems. :pray:

1 Like