From 97221eab2a5d466213be89cabead8e1ab6b72686 Mon Sep 17 00:00:00 2001 From: ai-bot Date: Sat, 14 Nov 2026 17:44:53 +0000 Subject: [PATCH] Patch docs/spec.md --- docs/spec.md | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/docs/spec.md b/docs/spec.md index 985b93c..de7be64 100644 --- a/docs/spec.md +++ b/docs/spec.md @@ -46,11 +46,26 @@ This app is a deliberate exception to the "everything in the repository is Engli Never translate user-facing text to English. Never write code identifiers in Norwegian. -Formatting: amounts as `1 234 567,89 kr` (space as thousands separator, comma as decimal -separator), dates as `31.12.2025` in the UI, `YYYY-MM-DD` in the database and the API. The -storage layer holds BTC as integer **sats** and NOK as integer **øre**; floating point is never -used for money. The one exception is the display of a BTC price in NOK, which is converted to -øre on input. +Display and storage rules, in one place, because they are easy to get wrong: + +- **BTC is always shown in sats, never in BTC.** A quantity is a whole number with a space as + the thousands separator: `1 500 000 sats`. No decimals, ever. The stored value is integer + sats; the `10^8` conversion to BTC exists only inside the arithmetic that works out a price + or a formue. +- **NOK is always shown in whole kroner.** A displayed amount is a whole number with a space as + the thousands separator and the unit `kr`: `1 000 000 kr`. No decimals, ever. +- The stored value is integer **øre** and every calculation uses øre, so nothing is lost. The + rounding happens only when a figure is written out, and it rounds halves up. +- Decimals are accepted **only in an input field**: a NOK amount may be typed as `1 234,50` and + is stored as `123450` øre. When a form is filled from a stored transaction, an input shows the + exact stored value, decimals included, so that opening and saving a form cannot silently drop + øre. A sats input takes whole sats and rejects a decimal. +- Floating point is never used for money. +- Dates: `31.12.2025` in the UI, `YYYY-MM-DD` in the database and the API. +- The year-end rate is the one figure that is neither an amount nor a quantity. It is shown as + `1 060 375 kr per BTC`, and the settings table heads it `NOK per BTC`. It is the rate of + §3.5, not the price of a transaction; §7.3 defines the transaction price, which the UI calls + **Bitcoin pris**. ---