parseTemporal silently drops fractional parts on non-second duration units (e.g. `PT0.5H` -> `PT0H`)
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 74/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- node.js, typescript
- 領域
- tooling
調査の方向性
parseDuration() から始めます(src/parser.ts): 小数部の桁は単位指定子が読まれる前にすでに取得されていますが、それを保存するのは unit === 'S' の分岐だけです。secondsFraction の AST 型と stringifier の duration 分岐を読み、小数フィールドがどのように引き回されるかを確認したうえで、H/M/日付単位で小数を保持するか、ParseError を発生させるかを決めてください。issue の repro.mjs スニペットがチェックです。4 つの入力に対して実行し、出力が小数保持か明示的なエラーであり、暗黙の切り捨てではないことを確認してください。既存の duration ケースの隣に parser テストを追加してください。
索引モデルが issue の本文から書いたものです。
説明
parseTemporal accepts decimal fractions (. or ,) on any duration unit without throwing, but only preserves the fraction for seconds (S), silently truncating fractional hours, minutes, and date units to integers.
Playground: https://lxcid.com/tools/temporal-playground/?expr=PT0.5H
npm install @taskade/[email protected]
node repro.mjs
// repro.mjs
import { parseTemporal, stringifyTemporal } from "@taskade/temporal-parser";
for (const input of ["PT0.5H", "PT1.5M", "PT0,5H", "P1.5D"]) {
const ast = parseTemporal(input);
console.log(input, ast, stringifyTemporal(ast));
}
console.log(Temporal.Duration.from(parseTemporal("PT0.5H")).toString());
console.log(Temporal.Duration.from("PT0.5H").toString());
Actual output:
PT0.5H { kind: 'Duration', hours: 0, raw: 'PT0.5H', annotations: [] } PT0H
PT1.5M { kind: 'Duration', minutes: 1, raw: 'PT1.5M', annotations: [] } PT1M
PT0,5H { kind: 'Duration', hours: 0, raw: 'PT0,5H', annotations: [] } PT0H
P1.5D { kind: 'Duration', days: 1, raw: 'P1.5D', annotations: [] } P1D
PT0S
PT30M
Expected output:
ISO 8601 allows a decimal fraction on the lowest-order duration unit (and TC39 Temporal accepts fractions on H, M, and S), so parseTemporal should either preserve fractional non-second components in the AST or throw a ParseError when a fraction appears on an unsupported unit, rather than returning truncated integer fields (hours: 0 / "PT0H").
In src/parser.ts, parseDuration() consumes . / , and the fractional digits into fraction before reading the unit designator, then only stores fraction in the unit === 'S' branch (dur.secondsFraction = fraction) and ignores it in every other unit branch.
Versions: @taskade/[email protected] (main commit 729b967), Node.js v26.13.0 on Linux x64.
Credit: https://ucsbplse.github.io/
- 主要言語
- TypeScript
- スター
- 26
- フォーク
- 5
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
taskade/temporal-parser のほかの issue
-
bug: Support time only ISO-8601 format対応中かも @lxcid が 307 日前に担当しました。 オープン
taskade/temporal-parser#13 · リアクション 1 件 · 担当者 2 名 ·
taskade/temporal-parser の issue をすべて見る
似ている issue
-
db-d1-sqlite: upsert is aliased to updateOne, so payload.kv.set never inserts new keys対応中かも @pcbeingused333 が今日担当しました。 オープンBug db: d1-sqlite Payload OSS
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
payloadcms/payload#19766 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
device-management-toolkit/sample-web-ui#3711 ·
メンテナーはふだん 1 日以内に返信
-
bug impact:low Team: SecuritySolution Team:Defend Workflows v9.6.0
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
elastic/kibana#306401 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
agentes-chat/agentes-chat#927 ·
メンテナーはふだん 1 日以内に返信
-
Closing a pinned tab jumps to the Tabs section instead of the next open pinned tab対応中かも @seenimohamed が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
ardia-browser/ardia#2769 ·
メンテナーはふだん 1 日以内に返信