[BUG]: ISO 8601 date string inferred as String? instead of DateTime in Dart output
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 55/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- dart, typescript
Línea de trabajo
Reproduce the issue in app.quicktype.io and the quicktype CLI with the supplied JSON and Dart target, checking whether the “Detect dates & times” option is enabled. Trace the date-format inference and Dart generation path; done means the timestamp is inferred as DateTime (or DateTime? with nullability) and the generated code parses and serializes it accordingly.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
ISO 8601 date string inferred as String? instead of DateTime in Dart output
Issue Type
Quicktype output / Type inference issue
Context (Environment, Version, Language)
Input Format: JSON
Output Language: Dart
CLI, npm, or app.quicktype.io: app.quicktype.io / CLI
Version: Latest
Description
ISO 8601 formatted date-time strings (e.g., "2025-08-19T08:08:45.087") are currently being typed as optional String? rather than being detected as DateTime types in Dart code generation. Older versions of quicktype automatically recognized ISO date strings and generated DateTime.parse() / toIso8601String() methods.
Input Data
{
"LastRecorded": "2025-08-19T08:08:45.087"
}
Expected Behaviour / Output
ISO date-time strings should be inferred as DateTime (or DateTime? if nullability is enabled), producing parsing logic like:
import 'dart:convert';
Welcome welcomeFromJson(String str) => Welcome.fromJson(json.decode(str));
String welcomeToJson(Welcome data) => json.encode(data.toJson());
class Welcome {
DateTime lastRecorded;
Welcome({
required this.lastRecorded,
});
factory Welcome.fromJson(Map<String, dynamic> json) => Welcome(
lastRecorded: DateTime.parse(json["LastRecorded"]),
);
Map<String, dynamic> toJson() => {
"LastRecorded": lastRecorded.toIso8601String(),
};
}
Current Behaviour / Output
The field is treated as a generic nullable String?:
import 'dart:convert';
Temperatures temperaturesFromJson(String str) => Temperatures.fromJson(json.decode(str));
String temperaturesToJson(Temperatures data) => json.encode(data.toJson());
class Temperatures {
String? lastRecorded;
Temperatures({
this.lastRecorded,
});
factory Temperatures.fromJson(Map<String, dynamic> json) => Temperatures(
lastRecorded: json["LastRecorded"],
);
Map<String, dynamic> toJson() => {
"LastRecorded": lastRecorded,
};
}
Steps to Reproduce
- Open
app.quicktype.io(or runquicktypeCLI). - Set target language to Dart.
- Input JSON containing an ISO 8601 timestamp:
{"LastRecorded": "2025-08-19T08:08:45.087"}. - Observe that
lastRecordedis generated asString?instead ofDateTime.
Possible Solution
Ensure string format inference checks ISO 8601 patterns prior to defaulting to String for Dart generation, or verify that the "Detect dates & times" option setting is active in the Dart target options.
- Lenguaje dominante
- TypeScript
- Estrellas
- 13.9k
- Forks
- 1.2k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de glideapps/quicktype
-
Swift: use file-private JSON helpers for standalone outputPosiblemente ocupada @foobra la tomó hace 77 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
CI
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
-
bug
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 45/100
-
[BUG]:Abiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Todos los issues de glideapps/quicktype
Issues similares
-
Add: Yemen Education SDAbiertostreams:add
Dificultad 2/5 Menos de una hora Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
apache/rocketmq-dashboard#6872 ·
Los mantenedores suelen responder en 3 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
interledger/publisher-tools#931 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
ARTPARK-SAHAI-ORG/calibrate-frontend#727 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
fab-geocommuns/RNB-site#539 ·
Los mantenedores suelen responder en 2 días