{"record":{"id":"fca1b1c815ecbfc2","repo":"kestra-io/kestra","slug":"the-islastworkingday-function-could-not-parse","errorCode":null,"errorMessage":"The 'isLastWorkingDay()' function could not parse 'date': {e.getMessage()}","messagePattern":"The 'isLastWorkingDay\\(\\)' function could not parse 'date': (.+?)","errorType":"exception","errorClass":"PebbleException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/io/kestra/core/runners/pebble/functions/IsLastWorkingDayFunction.java","lineNumber":56,"sourceCode":"\n    private static final Set<DayOfWeek> DEFAULT_WORKING_DAYS = EnumSet.of(\n        DayOfWeek.MONDAY, DayOfWeek.TUESDAY, DayOfWeek.WEDNESDAY,\n        DayOfWeek.THURSDAY, DayOfWeek.FRIDAY\n    );\n\n    @Override\n    public Object execute(Map<String, Object> args, PebbleTemplate self, EvaluationContext context, int lineNumber) {\n        Object dateArg = args.get(\"date\");\n\n        if (dateArg == null) {\n            throw new PebbleException(null, \"The 'isLastWorkingDay()' function expects a 'date' argument.\", lineNumber, self.getName());\n        }\n\n        LocalDate localDate;\n        try {\n            localDate = DateUtils.parseLocalDate(dateArg.toString());\n        } catch (InternalException e) {\n            throw new PebbleException(e, \"The 'isLastWorkingDay()' function could not parse 'date': \" + e.getMessage(), lineNumber, self.getName());\n        }\n\n        Set<DayOfWeek> workingDays = resolveWorkingDays(args.get(\"workingDays\"), self, lineNumber);\n\n        if (!workingDays.contains(localDate.getDayOfWeek())) {\n            return false;\n        }\n\n        // Walk backwards from the last calendar day of the month to find the last working day\n        LocalDate lastOfMonth = localDate.with(TemporalAdjusters.lastDayOfMonth());\n        LocalDate candidate = lastOfMonth;\n        while (!workingDays.contains(candidate.getDayOfWeek())) {\n            candidate = candidate.minusDays(1);\n        }\n\n        return localDate.isEqual(candidate);\n    }\n","sourceCodeStart":38,"sourceCodeEnd":74,"githubUrl":"https://github.com/kestra-io/kestra/blob/823fada9274c4f9c251ea0a516460a4f7d958032/core/src/main/java/io/kestra/core/runners/pebble/functions/IsLastWorkingDayFunction.java#L38-L74","documentation":"isLastWorkingDay() could not parse the date argument with DateUtils.parseLocalDate; the value is not a recognizable ISO 8601 date or datetime. The wrapped InternalException message gives the parse detail.","triggerScenarios":"Passing date like '31/01/2024' (locale order, slashes), 'Jan 31 2024', 'tomorrow', or an empty string.","commonSituations":"Locale-specific date formats, relative words, or a templated value that rendered to something unexpected.","solutions":["Provide an ISO 8601 date ('YYYY-MM-DD') or datetime ('YYYY-MM-DDTHH:mm:ss').","Pre-format the date before passing.","Inspect the appended parse error message."],"exampleFix":"// before\n{{ isLastWorkingDay(date='31/01/2024') }}\n// after\n{{ isLastWorkingDay(date='2024-01-31') }}","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pass dates in ISO 8601 form: 'YYYY-MM-DD' or 'YYYY-MM-DDTHH:mm:ss'.","Pre-format locale-specific dates into ISO form before passing.","Inspect the appended parse error message for the failing token."],"tags":["pebble","date","parsing","iso8601"],"backgroundTag":null,"analyzedSha":"823fada9274c4f9c251ea0a516460a4f7d958032","analyzedAt":"2026-08-14T06:15:17.947Z","schemaVersion":2},"datasetVersion":"2026-08-14T10:17:34.591Z"}