Type Rules for Money and Timestamps
Added 2026-10
Type Rules for Money and Timestamps — Chinese original prompt
接口里的 [字段名] 等金额与时间字段在各处写法不一,有浮点、有字符串、有本地时间格式。请定一套约定:金额用什么类型和单位、时间用什么格式和时区、空值怎么表示,并说明各语言解析时的注意事项。输出:字段类型规范、现有接口的整改清单、以及序列化与反序列化的示例。
Site original
Chinese original
Example
Sample input
接口里金额和时间的写法不一,有浮点有字符串有本地格式,定一套统一约定。
The output should include
- 定金额类型、单位与时间格式时区
- 说明空值表示与各语言解析注意
- 按约定给现有接口整改清单
Replace these placeholders 1
Swap the bracketed parts for your own details before sending.
[字段名]
How to use
金额用最小货币单位的整数或字符串,别指望浮点在跨语言时表现一致。
Try tweaking it
- Have it restate requirements and constraints before writing code.
- Ask for the smallest change plus a rollback path, not a full-file rewrite.
What you should get
- A minimal, runnable change with copy-ready code
- Impact list: which files and call sites must follow
Common mistakes
- Asking it to touch ten files at once, then losing track of what broke what.
- Pasting only the error, with no code or version, and getting an unfixable answer.
How to check the output
- The change runs, can be rolled back, and touches nothing unrelated.
- Edge cases (empty, oversized, concurrent) are covered or explained.
Where it works
- Good for: having it restate requirements and constraints, then propose the smallest runnable change.
- Watch out: include versions and a minimal reproduction with the error, or the fix may look plausible but not fit.