Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Enforces explicit business time zones for current-time calls in Java, Go and JavaScript code.
91% 100%+9 ptsof test cases passed
Passed 22 of 22 test cases with the skill, and 20 of 22 without it.
Write a bash shell command pipeline to search `src/main/java/` for unzoned `LocalDate.now()` or `LocalDateTime.now()` calls while filtering out legitimate constant declarations.
filters out TimeConstants or configuration files using grep invert match
3 of 3 safety checks passed
服务端代码里,"当前时间"几乎从不应该裸调。一个 docker 镜像默认 UTC、一个生产机配置 Asia/Shanghai,同一份代码跑出来的"本周起点"就差 8 小时。
配套:
query-performance-safety(性能) /multi-tenant-safety(隔离)
.now() 依赖 JVM 默认时区场景: LocalDate.now() / LocalDateTime.now() / Instant.now() / new Date() 不传时区
LocalDate.now() 在 UTC 服务器上返回的"今天"比业务时区少 1 天(凌晨场景)LocalDateTime.now() 拿到的是 JVM 默认时区时间,docker base image 经常默认 UTC// ❌ 错误:依赖 JVM 默认时区
LocalDateTime weekStart = LocalDate.now()
.with(DayOfWeek.MONDAY)
.atStartOfDay();
// ❌ 错误:跨日切换的统计依赖默认时区
LocalDate today = LocalDate.now();
List<Order> todayOrders = orderRepository.findByCreatedAtAfter(today.atStartOfDay());
// ❌ 错误:Date 用默认时区
Date now = new Date();
项目级业务时区常量 + 所有 .now() 显式传入:
Published skills whose descriptions closely match this one, with their benchmark result.
Next to this one in the catalogue, plus more from the same author.