Naive datetime values are interpreted in the host's local time zone
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Bắt đầu tại RustyPyType::try_into_value và kiểm tra việc chuyển đổi datetime, sau đó xem lại tài liệu tham chiếu Python API, hướng dẫn bắt đầu nhanh, các tutorial và các ví dụ trong docstring của Context.add_variable. So sánh ba chính sách được đề xuất cho datetime naive với hành vi hiện tại và định hướng của dự án. Công việc được xem là hoàn tất khi chính sách đã được thống nhất, được triển khai nếu cần, và tất cả các ví dụ tài liệu bị ảnh hưởng đều phản ánh chính sách đó một cách nhất quán.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Behaviour
Converting a Python value to a CEL timestamp (in RustyPyType::try_into_value) handles a timezone-aware datetime correctly, but a naive one is passed through chrono::Local, so the same datetime(2026, 1, 1, 12) is a different instant on a UTC server and on a developer's laptop. CEL timestamps are absolute instants, and every timestamp(...) literal an expression builds is UTC, so comparisons like created > timestamp("2026-01-01T00:00:00Z") silently depend on TZ.
datetime.now() (naive) is the common way to hit this. The quick-start guide, the tutorials and the Context.add_variable docstring all use naive datetime.now() as the example value, so the docs currently teach the footgun.
Options
- Keep local, document loudly. Matches Python's own convention (
naive.timestamp()assumes local time). Least disruptive; add a warning box to the Python API reference and the datetime section of the tutorial, and switch the doc examples todatetime.now(timezone.utc). - Treat naive as UTC. Deterministic across machines and matches what most server code means. Silent behaviour change for anyone relying on option 1.
- Reject naive datetimes with a
ValueErrorthat says to attach atzinfo. Loudest and safest; a breaking change for existing callers.
My lean is 1 now (with the doc examples fixed) and 3 at the 1.0 boundary, since a policy engine that gives different answers per host TZ is the kind of bug that only shows up in production. Opinions welcome before anything changes.
- Ngôn ngữ chính
- Python
- Star
- 43
- Fork
- 4
- Merge trung bình
- 12 giờ 37 phút
- Pull request đã merge (30 ngày)
- 11
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không 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 hardbyte/python-common-expression-language
-
enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
hardbyte/python-common-expression-language#47 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
hardbyte/python-common-expression-language#57 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
hardbyte/python-common-expression-language#49 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 45/100
hardbyte/python-common-expression-language#48 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
hardbyte/python-common-expression-language#46 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của hardbyte/python-common-expression-language
Issue tương tự
-
bug frontend
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
PedestrianDynamics/pyFDS-Evac#552 ·
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 84/100
resend/resend-skills#144 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
update UV in dockerfileĐang mởgood first issue
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 68/100
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
GNS3/gns3-server#2935 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
TauricResearch/TradingAgents#1476 ·
Maintainer thường phản hồi trong vòng 2 ngày