[BUG]: ISO 8601 date string inferred as String? instead of DateTime in Dart output
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 55/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- dart, typescript
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- TypeScript
- Star
- 13.9k
- Fork
- 1.2k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của glideapps/quicktype
-
Swift: use file-private JSON helpers for standalone outputCó thể đã có người làm @foobra đã nhận 77 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
-
CI
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
-
[BUG]:Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của glideapps/quicktype
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
aws/agentcore-cli#2606 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug Cosmetic
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-driven-qa bug claude Minor
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
linagora/twake-mail-admin#301 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày
-
reproduced
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
anomalyco/opencode#56038 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày