Signed years in `date` render as "Invalid Date" or the wrong year without a warning
Maintainer thường phản hồi trong vòng 1 ngày
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
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- deno, typescript
- Lĩnh vực
- backend
Hướng nghiên cứu
Everything sits in src/core/date.ts: parsePandocDate around lines 212-259 (the three-step @std/datetime / moment-guess / dayjs / new Date() chain with empty catches) and formatDate around lines 173-193 (the Intl versus day.js split). Reproduce first by rendering the report's qmd with quarto render for html and typst, then build the website project to see the listing sort, feed pubDate and citation year diverge. Done means an unreadable value produces a warning naming it and the six-digit form, no Invalid Date reaches output, feed or sort, and a negative year prints the same everywhere. Decide up front which engine owns signed years, since the two format paths disagree by design.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
I have
- searched the issue tracker for similar issues
- installed the latest version of Quarto CLI
- formatted my issue following the Bug Reports guide
Bug description
A date with a signed year either renders as Invalid Date or silently shows the wrong year.
This happens in the title block of every format, and in listings, RSS feeds and citations.
Quarto prints no warning.
JavaScript accepts a signed year only with exactly six digits (ECMA-262, Expanded Years).
The current day.js, Luxon, Moment, date-fns and Temporal all follow that rule, so rejecting +2026 or -2026 is fine.
The bugs are in what Quarto does after the rejection.
parsePandocDate reads a date in three steps, each with its own library:
@std/datetime0.225.4parsetries seven fixed patterns, such asyyyy-MM-dd. None accepts a sign. It throws when nothing matches.moment-guess1.2.4 guesses a format string. It knowsYYYYandYYYYYY, and throwsCouldn't parse dateon a signed year with four or five digits. When it does return a format, Quarto callsdayjs(dateStr, format), but day.js 1.8.21 ignoresformatunless thecustomParseFormatplugin is loaded, and Quarto does not load it. day.js then matches its own unsigned four-digit pattern, or hands the string tonew Date().- If both steps throw, Quarto calls
new Date(dateStr). This never throws, and nothing checks the result.
formatDate then uses one of two engines.
The full, long, medium and short styles use Intl through toLocaleString.
The iso style and custom patterns use day.js 1.8.21 format.
Some of the behaviour below comes from these dependencies:
-
The six-digit rule comes from ECMAScript, and every library follows it.
-
For a string outside the ECMAScript format, V8's legacy parser throws away a leading sign, then adds 2000 to years 0 to 49 and 1900 to years 50 to 99. The result is a valid
Date, so a validity check would not catch it. -
Intlstyles print no era, anderacannot be combined withdateStyle(TypeError). Astronomical year-2026(2027 BC) therefore shows as "2027". -
day.js 1.8.21 prints
YYYYas the raw astronomical year with no padding, so the same date shows as-2026there.
The rest comes from Quarto:
- The empty
catchblocks hide every failure, and no step warns. - Any string reaches
new Date(), including signed values that V8 can only misread. - An invalid
Dategoes on to every format, to the listing sort, to the feed and to the CSL date. - The two formatting engines disagree on negative years.
Related:
- #15406
- #9419
Steps to reproduce
Render this document with quarto render, using each date from the tables below.
---
title: "Signed years"
date: "+2026-11-20T14:40:49Z"
format:
html: default
typst:
keep-typ: true
latex: default
docx: default
gfm: default
---
Body.
For listings, feeds and citations, render a website project with one post per date, citation: true in each post, and this listing:
listing:
contents: posts
sort: "date desc"
type: table
feed: true
Actual behavior
Title block:
date |
HTML (default long) |
Typst, LaTeX, Word, Reveal.js, GFM (default iso) |
|---|---|---|
2026-11-20T14:40:49Z |
November 20, 2026 | 2026-11-20 |
+2026-11-20T14:40:49Z |
Invalid Date | Invalid Date |
-2026-11-20T14:40:49Z |
Invalid Date | Invalid Date |
+002026-11-20T14:40:49Z |
November 20, 2026 | 2026-11-20 |
-2026-11-20 |
November 20, 2026 | 2026-11-20 |
-002026-11-20 |
November 20, 2027 | -2026-11-20 |
-0001-01-01 |
January 1, 2001 | 2001-01-01 |
The same happens with five digits (+02026, -02026) and with every time shape I tried (T14:40:49, Z, .123Z, +01:00).
Listing, feed and citation:
date |
Listing | Feed pubDate |
Citation in the appendix |
|---|---|---|---|
2026-11-20T14:40:49Z |
Nov 20, 2026 | Fri, 20 Nov 2026 14:40:49 GMT | B, A. 2026. |
+2026-11-20T14:40:49Z |
Invalid Date | Invalid Date | B, A. (no year) |
-2026-11-20T14:40:49Z |
Invalid Date | Invalid Date | B, A. (no year) |
-2026-11-20 |
Nov 20, 2026 | Thu, 19 Nov 2026 23:00:00 GMT | B, A. 2026. |
-002026-11-20 |
Nov 20, 2027 | Wed, 20 Nov -2026 00:00:00 GMT | B, A. 2027 BC. |
-0001-01-01 |
Jan 1, 2001 | Sun, 31 Dec 2000 23:00:00 GMT | B, A. 2001. |
With sort: "date desc" and a control post dated 1999-05-05, the invalid dates break the order.
The listing shows 2026, 1999, the two invalid posts, then 2026 again.
Expected behavior
- A date that Quarto cannot read gives a warning that names the value and the six-digit form, and
Invalid Datedoes not reach the output, the feed or the sort. - A signed year without six digits never renders as a different year.
- A negative year shows the same year in every
date-formatstyle.
Your environment
- Quarto: development build of
mainat cda41021442b20964e10e265b9dcdf81f490c18e (newer than 1.12.3). - OS: macOS 27.2.1, Apple Silicon.
Quarto check output
Quarto 99.9.9
[✓] Checking environment information...
Quarto cache location: /Users/mcanouil/Library/Caches/quarto
Project: none found (single-file mode)
[✓] Checking versions of quarto binary dependencies...
Pandoc version 3.13.0: OK
Dart Sass version 1.107.1: OK
Deno version 2.9.8: OK
Typst version 0.15.1: OK
[✓] Checking versions of quarto dependencies......OK
[✓] Checking Quarto installation......OK
Version: 99.9.9
commit: cda41021442b20964e10e265b9dcdf81f490c18e
Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/package/dist/bin
[✓] Checking tools....................OK
TinyTeX: v2026.11
VeraPDF: 1.30.3
Chrome Headless Shell: (not installed)
[✓] Checking LaTeX....................OK
Using: TinyTex
Path: /Users/mcanouil/Library/TinyTeX/bin/universal-darwin
Version: 2026
[✓] Checking Chrome Headless....................OK
Using: Chrome from QUARTO_CHROMIUM
Path: /Applications/Brave Browser.app/Contents/MacOS/Brave Browser
[✓] Checking basic markdown render....OK
R version 4.6.1 (2026-06-24)
Config '~/.Rprofile' was loaded!
[✓] Checking R installation...........OK
Version: 4.6.1
Path: /Library/Frameworks/R.framework/Versions/4.6/Resources
LibPaths:
- /Users/mcanouil/Library/R/arm64/4.6/library
- /Library/Frameworks/R.framework/Versions/4.6/Resources/library
knitr: 1.51
rmarkdown: 2.31
[✓] Checking Knitr engine render......OK
[✓] Checking Python 3 installation....OK
Version: 3.14.7
Path: /Users/mcanouil/Projects/quarto-dev/quarto-cli/tests/.venv/bin/python3
Jupyter: 5.9.1
Kernels: gribouille-post, julia-1.12, python3
[IPKernelApp] WARNING | Kernel is running over TCP without encryption. All communication (including code and outputs) is sent in plain text and is susceptible to eavesdropping. Use IPC transport or launch with kernel manager-provisioned CurveZMQ keys to enable transport encryption.
[✓] Checking Jupyter engine render....OK
[✓] Checking Julia installation...
- Ngôn ngữ chính
- JavaScript
- Star
- 6.2k
- Fork
- 492
- Merge trung bình
- 15 giờ 15 phút
- Pull request đã merge (30 ngày)
- 94
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 quarto-dev/quarto-cli
-
bootstrap enhancement themes
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
quarto-dev/quarto-cli#15421 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 85/100
quarto-dev/quarto-cli#15408 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 79/100
quarto-dev/quarto-cli#15401 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug callouts docx regression
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 81/100
quarto-dev/quarto-cli#15394 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug lightbox
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
quarto-dev/quarto-cli#15393 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của quarto-dev/quarto-cli
Issue tương tự
-
bug help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 80/100
LangerSword/gitone#7 ·
-
good first issue reliability security should-have
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 13 ngày
-
[BUG]: chunkSource protocol stripping truncates URLs or reads an inner schemeCó thể đã có người làm @Bensonbenyi đã nhận hôm nay. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Mintplex-Labs/anything-llm#7338 ·
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 74/100
Maintainer thường phản hồi trong vòng 1 ngày