DatePicker omits timezone for initially empty fields despite zoned placeholderValue

Đang mở Phù hợp với người mới
#10,900 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@mrlexcoder đang làm issue này rồi.

Từ ngày 3/11/2026.

  • #10911 của @mrlexcoder — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/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ệ
react, typescript
Lĩnh vực
frontend

Hướng nghiên cứu

Đoạn mã liên quan là placeholderValue trong DatePicker.tsx: nó được tách từ props nhưng không được truyền vào AriaDatePicker, và chỉ đến được TimeField của popover. Hãy bắt đầu bằng việc đọc cách component xây dựng props, sau đó chạy bản tái hiện StackBlitz được liên kết để xác nhận giá trị được gửi đi không có múi giờ. Hoàn thành khi một DatePicker rỗng với placeholderValue có múi giờ gửi đi một giá trị bao gồm múi giờ UTC và các test DatePicker hiện có vẫn pass.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug
Provide a general summary of the issue here

An initially empty DatePicker with placeholderValue={now("UTC")} produces a date-time without a timezone after selecting a date.

🤔 Expected Behavior?

The selected value should inherit the UTC timezone from placeholderValue.

😯 Current Behavior

Selecting 2 November 2026 and submitting the form sends 2026-11-02T00:00:00. The value contains neither a timezone identifier nor an offset.

💁 Possible Solution

DatePicker.tsx destructures placeholderValue out of its props but does not forward it to <AriaDatePicker>. It only passes it to the popover’s TimeField.

🔦 Context

This affects a form containing date pickers. The backend expects zoned date-times for all submissions, so it rejects the submitted values.

🖥️ Steps to Reproduce

https://stackblitz.com/edit/e6rtt68y?file=src%2FExample.tsx

  1. Open the page
  2. Open the calendar popup and select a date
  3. Submit the form
  4. Observe the submitted value
Version

@react-spectrum/s2 1.8.2

What browsers are you seeing the problem on?

Chrome

If other, please specify.

No response

What operating system are you using?

macOS

🧢 Your Company/Team

No response

🕷 Tracking Issue

No response

Ngôn ngữ chính
TypeScript
Star
16k
Fork
1.6k
Merge trung bình
3 ngày 9 giờ
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của adobe/react-spectrum

Tất cả issue của adobe/react-spectrum

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.