{"record":{"id":"cb06123fff7a9a2b","repo":"floci-io/floci","slug":"invalid-awsdatetime","errorCode":null,"errorMessage":"Invalid AWSDateTime: {}","messagePattern":"Invalid AWSDateTime: (.+?)","errorType":"validation","errorClass":"CoercingParseValueException","httpStatus":null,"severity":"error","filePath":"src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java","lineNumber":73,"sourceCode":"            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_DATE_TIME = GraphQLScalarType.newScalar()\n        .name(\"AWSDateTime\")\n        .description(\"An ISO-8601 datetime string\")\n        .coercing(new Coercing<String, String>() {\n            @Override\n            public String serialize(Object dataFetcherResult) {\n                return dataFetcherResult != null ? dataFetcherResult.toString() : null;\n            }\n            @Override\n            public String parseValue(Object input) {\n                String str = input.toString();\n                try {\n                    Instant.parse(str);\n                } catch (DateTimeParseException e) {\n                    throw new CoercingParseValueException(\"Invalid AWSDateTime: \" + str);\n                }\n                return str;\n            }\n            @Override\n            public String parseLiteral(Object input) {\n                if (!(input instanceof StringValue sv)) return null;\n                return parseValue(sv.getValue());\n            }\n        })\n        .build();\n\n    public static final GraphQLScalarType AWS_DATE = GraphQLScalarType.newScalar()\n        .name(\"AWSDate\")\n        .description(\"An ISO-8601 date string (yyyy-MM-dd)\")\n        .coercing(new Coercing<String, String>() {\n            @Override\n            public String serialize(Object dataFetcherResult) {\n                return dataFetcherResult != null ? dataFetcherResult.toString() : null;","sourceCodeStart":55,"sourceCodeEnd":91,"githubUrl":"https://github.com/floci-io/floci/blob/62ff490619e7bd3554597c28c704081b4c15add5/src/main/java/io/github/hectorvent/floci/services/appsync/graphql/scalars/AppSyncScalars.java#L55-L91","documentation":"Thrown by the AWSDateTime scalar's parseValue when the string cannot be parsed as an ISO-8601 instant. The coercion uses java.time.Instant.parse, which only accepts ISO-8601 formatted instant strings in UTC such as 2024-01-15T10:30:00Z (with optional fractional seconds).","triggerScenarios":"A GraphQL request supplies an AWSDateTime variable like \"2024-01-15 10:30:00\" (space separator), \"2024-01-15T10:30:00+02:00\" (offset, not Z), \"01/15/2024\", or an epoch-millis number rendered as string. Instant.parse fails on each and the coercion throws.","commonSituations":"Formatting dates with a locale-dependent formatter (MM/dd/yyyy); forgetting to convert a ZonedDateTime/OffsetDateTime to UTC before sending; serializing java.util.Date via toString() which yields \"Mon Jan 15 ...\"; database or frontend timestamps that carry a local offset.","solutions":["Normalize to UTC and format with DateTimeFormatter.ISO_INSTANT: Instant.now().toString() or DateTimeFormatter.ISO_INSTANT.format(zdt.toInstant())","If the source has an offset, convert first: offsetDateTime.toInstant().toString()","Never use SimpleDateFormat patterns or Date.toString() for AWSDateTime fields","Add a client-side check: try { Instant.parse(s); } catch before sending"],"exampleFix":"// before\nString when = zonedDateTime.toString(); // 2024-01-15T10:30+02:00 -> throws\n\n// after\nString when = zonedDateTime.toInstant().toString(); // 2024-01-15T08:30:00Z","handlingStrategy":"validation","validationCode":"static String toAwsDateTime(Instant i) { return i.toString(); }\nstatic boolean validAwsDateTime(String s) { try { Instant.parse(s); return true; } catch (DateTimeParseException e) { return false; } }\nif (!validAwsDateTime(s)) throw new IllegalArgumentException(\"AWSDateTime must be ISO-8601 UTC like 2024-01-15T10:30:00Z\");","typeGuard":"// TS\nconst isAwsDateTime = (s: string): boolean => !isNaN(Date.parse(s)) && /Z$/.test(s);","tryCatchPattern":"catch (CoercingParseValueException e) { // show field name + expected ISO-8601 UTC format to the user }","preventionTips":["Always convert ZonedDateTime/OffsetDateTime to Instant before formatting","Use Instant.toString()/ISO_INSTANT; avoid SimpleDateFormat and Date.toString()","Validate with Instant.parse in a shared client util before every request"],"tags":["graphql","appsync","awsdatetime","iso-8601","date","validation"],"backgroundTag":null,"analyzedSha":"62ff490619e7bd3554597c28c704081b4c15add5","analyzedAt":"2026-08-14T14:25:23.764Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}