LanguageValues and typesStandard typesCommerce and logistics
Dimensions
On this page
A box's length, width and height.
Use it for parcels and products. For a picture's size in pixels, use ImageDimensions. For one measurement, use Length.
Shape
Example
Dimensions { length: 30cm width: 20cm height: 10cm }Good to know
- None can be below zero.
text.formatshows centimetres,30 × 20 × 10 cm, or another unit withunit:. ==tells you whether two are the same.<andlist.sort_bydon't take it, so sort by one of its parts instead.
In JSON
An object of its parts, in a request, a response or json.write:
{"length":{"value":"0.3","unit":"metre"},"width":{"value":"0.2","unit":"metre"},"height":{"value":"0.1","unit":"metre"}}{"length":{"value":"1.2","unit":"metre"},"width":{"value":"0.8","unit":"metre"},"height":{"value":"0.144","unit":"metre"}}{"length":{"value":"0.3048","unit":"metre"},"width":{"value":"0.2286","unit":"metre"},"height":{"value":"0.1016","unit":"metre"}}
Details
Text form, storage, how it is shown, and operations
Dimensions is in the group Commerce and logistics, and has been in Jadpo since 0.1.0.
Text form
It has no single text form, so text.from and text.parse don't take it.
How it is stored
It is stored in 3 columns, each named for the field, _ and its suffix. This is {"length":{"value":"1.2","unit":"metre"},"width":{"value":"0.8","unit":"metre"},"height":{"value":"0.144","unit":"metre"}}:
| Column | Type | Holds |
|---|---|---|
<field>_length |
numeric(38, 6) |
1.2 |
<field>_width |
numeric(38, 6) |
0.8 |
<field>_height |
numeric(38, 6) |
0.144 |
How it is shown to people
text.format(value, locale:) shows it to people in their locale. A call may also give unit:.
With locale: Locale.en_gb:
| Value | Shown |
|---|---|
{"length":{"value":"0.3","unit":"metre"},"width":{"value":"0.2","unit":"metre"},"height":{"value":"0.1","unit":"metre"}} |
30 × 20 × 10 cm |
{"length":{"value":"1.2","unit":"metre"},"width":{"value":"0.8","unit":"metre"},"height":{"value":"0.144","unit":"metre"}} |
120 × 80 × 14.4 cm |
{"length":{"value":"12","unit":"inch"},"width":{"value":"9","unit":"inch"},"height":{"value":"4","unit":"inch"}} |
30.48 × 22.86 × 10.16 cm |
Operations
It also takes text.format, json.read, json.write and ==. How every standard type behaves says how they work.
Markdown for agents: /docs/types/type-dimensions.md.Built from Jadpo main at aee2e8f.