{"record":{"id":"62d6f3599fcdd084","repo":"makeplane/plane","slug":"invalid-date-format-date-part","errorCode":null,"errorMessage":"Invalid date format: {date_part}","messagePattern":"Invalid date format: (.+?)","errorType":"exception","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"apps/api/plane/utils/filters/converters.py","lineNumber":296,"sourceCode":"                if not self._validate_date(value):\n                    if strict:\n                        raise ValueError(f\"Invalid date format: {value}\")\n                    continue\n                exact_dates.append(value)\n            else:\n                # Directional date - only handle basic after/before\n                parts = value.split(\";\")\n                if len(parts) < 2:\n                    if strict:\n                        raise ValueError(f\"Invalid date format: {value}\")\n                    continue\n\n                date_part = parts[0]\n                direction = parts[1]\n\n                if not self._validate_date(date_part):\n                    if strict:\n                        raise ValueError(f\"Invalid date format: {date_part}\")\n                    continue\n\n                if direction == \"after\":\n                    after_dates.append(date_part)\n                elif direction == \"before\":\n                    before_dates.append(date_part)\n                # Skip unsupported directions\n\n        # Determine return format\n        result = {}\n        if len(after_dates) == 1 and len(before_dates) == 1 and len(exact_dates) == 0:\n            # Simple range: one after and one before\n            start_date = min(after_dates[0], before_dates[0])\n            end_date = max(after_dates[0], before_dates[0])\n            self._add_rich_filter(result, field_name, \"range\", [start_date, end_date])\n        elif len(exact_dates) == 1 and len(after_dates) == 0 and len(before_dates) == 0:\n            # Single exact date\n            self._add_rich_filter(result, field_name, \"exact\", exact_dates[0])","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/makeplane/plane/blob/1c8a60f858d8472aa56e29994ec1c7926da2c6ce/apps/api/plane/utils/filters/converters.py#L278-L314","documentation":"ValueError raised in `_process_date_field` (converters.py:296) when `strict=True`, the directional value splits into >= 2 parts, but `parts[0]` (the date_part) fails `_validate_date` (dateutil parse). Only the date portion is reported. Direction values other than 'after'/'before' are silently skipped (no error), so this error is specifically about the date half.","triggerScenarios":"Passing strict=True with a directional value whose date part is unparseable - e.g. 'NaN;after', '2024-13-99;before', or 'foo;after'. The message interpolates only the date_part, not the direction.","commonSituations":"User fills a date range with a label instead of a date in the first slot; locale-formatted date dateutil rejects; copy-paste placing the direction first ('after;2024-08-12') - the parser then tries 'after' as a date and fails.","solutions":["Put a valid ISO date in the date slot and 'after'/'before' in the direction slot: `<ISO-date>;after`.","Verify ordering - date comes first, then direction.","Use strict=False to skip values with unparseable date parts.","Pre-validate parts[0] with dateutil.parser.parse client-side before composing the directional string."],"exampleFix":"# before\nfilters = {\"target_date\": [\"after;2024-08-12\"]}  # 'after' parsed as date -> fails\n\n# after\nfilters = {\"target_date\": [\"2024-08-12;after\"]}","handlingStrategy":"validation","validationCode":"from dateutil.parser import parse as dateutil_parse\n\ndef is_valid_directional_date(value: str) -> bool:\n    # date_part (parts[0]) must parse; direction must be after|before (else silently skipped)\n    if ';' not in value:\n        return True\n    parts = value.split(';')\n    if len(parts) < 2:\n        return False\n    try:\n        dateutil_parse(parts[0]); return True\n    except (ValueError, TypeError):\n        return False","typeGuard":null,"tryCatchPattern":"try:\n    converter.convert(filters, strict=True)\nexcept ValueError as e:\n    if 'Invalid date format' in str(e):\n        # e message contains only the bad date_part\n        report(e)","preventionTips":["Put the ISO date first, direction second: <date>;after.","Verify parts[0] parses with dateutil before composing the value.","Remember unsupported directions are silently skipped - this error is only about the date half."],"tags":["filters","validation","date","value-error"],"backgroundTag":null,"analyzedSha":"1c8a60f858d8472aa56e29994ec1c7926da2c6ce","analyzedAt":"2026-08-12T14:44:31.636Z","schemaVersion":2},"datasetVersion":"2026-08-12T18:17:37.767Z"}