Patch docs/spec.md

This commit is contained in:
ai-bot committed 2026-11-14 17:44:53 +00:00
1 parent 4bc0b0d01d
commit 97221eab2a
1 file changed
+20 -5
+20 -5
View File
@@ -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**.
---