Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[BUG]: ISO 8601 date string inferred as String? instead of DateTime in Dart output

オープン
#3,533 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
55/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
dart, typescript
領域
compilers, tooling

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

bug

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

  1. Open app.quicktype.io (or run quicktype CLI).
  2. Set target language to Dart.
  3. Input JSON containing an ISO 8601 timestamp: {"LastRecorded": "2025-08-19T08:08:45.087"}.
  4. Observe that lastRecorded is generated as String? instead of DateTime.

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.

主要言語
TypeScript
スター
13.9k
フォーク
1.2k
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

glideapps/quicktype のほかの issue

glideapps/quicktype の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。