# Text, number, date and time

The plain values: a line of text, a number, a date, a date with a time, and the slug that becomes part of an entry's URL.

## Text

`f.text()` is a single line. `.max(n)` limits it in characters, and publish enforces the limit. There is no multi-line text field: paragraphs are [richtext](https://smoodly.io/docs/fields/richtext.md), which keeps formatting as data rather than as line breaks.

File: `components/elements/Cta.schema.ts`

```ts
  fields: {
    heading: f.text().max(80),
    text: f.text().max(200).optional(),
    label: f.text().max(40),
    href: f.link(),
  },
```

Text is the one field editors can change in place in the canvas, when its element carries a [mark](https://smoodly.io/docs/content-modeling/marks.md).

## Number

`f.number()` shows a number box and stores a number. An empty box stores nothing, so an optional number is `undefined` in the view, not `0`.

## Date and time

`f.date()` is a calendar: a text box the editor may type into, and a calendar button that opens a month grid. It stores the day as `2026-09-02`, and publish refuses anything else — `2.9.2026` or a February 30th never reach the site. The view formats it for the reader; the starter formats in the page's language:

File: `components/articles.ts`

```ts
export const formatDate = (iso: string, locale: string) =>
  new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeZone: "UTC" }).format(new Date(iso));
```

`f.datetime()` is the same calendar with an hour and a minute beside it. It stores a moment in time as a UTC instant, `2026-09-02T14:30:00Z`, so an event start or a publish-at means the same thing in every zone and sorts as a string. The editor picks in the site's time zone, and a hint under the field names it.

The site's zone is one line of config, an IANA name:

File: `smoodly/config.ts`

```ts
export const config = defineConfig({
  // …
  locales: { default: routing.defaultLocale, supported: [...routing.locales] },
  // Editors pick dates and times in this zone; the views format with it (an IANA name, never an offset).
  timeZone: "Europe/Helsinki",
  // …
});
```

Name a city, never an offset. `"+3"` is wrong half the year; `Europe/Helsinki` carries the daylight-saving rules, and the browser and Node apply them from their own zone database. `defineConfig` refuses a name the runtime does not know. Without `timeZone`, editors pick in their own browser's zone, and the hint says so.

A view formats a datetime with the same zone:

File: `components/articles.ts`

```ts
export const formatDateTime = (iso: string, locale: string, timeZone: string) =>
  new Intl.DateTimeFormat(locale, { dateStyle: "medium", timeStyle: "short", timeZone }).format(new Date(iso));
```

Pass `config.timeZone` from your config file. A collection can order its entries by either field, as the starter's articles do with `order: { by: "date", direction: "desc" }`.

### Time zones in Europe

The value to put in `timeZone`, country by country. A country with several zones has its capital first.

| Country | timeZone |
| --- | --- |
| `Albania` | Europe/Tirane |
| `Andorra` | Europe/Andorra |
| `Austria` | Europe/Vienna |
| `Belarus` | Europe/Minsk |
| `Belgium` | Europe/Brussels |
| `Bosnia and Herzegovina` | Europe/Sarajevo |
| `Bulgaria` | Europe/Sofia |
| `Croatia` | Europe/Zagreb |
| `Cyprus` | Asia/Nicosia |
| `Czechia` | Europe/Prague |
| `Denmark` | Europe/Copenhagen |
| `Estonia` | Europe/Tallinn |
| `Faroe Islands` | Atlantic/Faroe |
| `Finland` | Europe/Helsinki |
| `Åland` | Europe/Mariehamn |
| `France` | Europe/Paris |
| `Germany` | Europe/Berlin (Büsingen: Europe/Busingen) |
| `Gibraltar` | Europe/Gibraltar |
| `Greece` | Europe/Athens |
| `Guernsey` | Europe/Guernsey |
| `Hungary` | Europe/Budapest |
| `Iceland` | Atlantic/Reykjavik |
| `Ireland` | Europe/Dublin |
| `Isle of Man` | Europe/Isle_of_Man |
| `Italy` | Europe/Rome |
| `Jersey` | Europe/Jersey |
| `Kosovo` | Europe/Belgrade |
| `Latvia` | Europe/Riga |
| `Liechtenstein` | Europe/Vaduz |
| `Lithuania` | Europe/Vilnius |
| `Luxembourg` | Europe/Luxembourg |
| `Malta` | Europe/Malta |
| `Moldova` | Europe/Chisinau |
| `Monaco` | Europe/Monaco |
| `Montenegro` | Europe/Podgorica |
| `Netherlands` | Europe/Amsterdam |
| `North Macedonia` | Europe/Skopje |
| `Norway` | Europe/Oslo (Svalbard: Arctic/Longyearbyen) |
| `Poland` | Europe/Warsaw |
| `Portugal` | Europe/Lisbon (Azores: Atlantic/Azores, Madeira: Atlantic/Madeira) |
| `Romania` | Europe/Bucharest |
| `Russia` | Europe/Moscow (also Europe/Kaliningrad, Europe/Samara, Europe/Astrakhan, Europe/Saratov, Europe/Ulyanovsk, Europe/Volgograd, Europe/Kirov) |
| `San Marino` | Europe/San_Marino |
| `Serbia` | Europe/Belgrade |
| `Slovakia` | Europe/Bratislava |
| `Slovenia` | Europe/Ljubljana |
| `Spain` | Europe/Madrid (Canary Islands: Atlantic/Canary) |
| `Sweden` | Europe/Stockholm |
| `Switzerland` | Europe/Zurich |
| `Turkey` | Europe/Istanbul |
| `Ukraine` | Europe/Kyiv (Crimea: Europe/Simferopol) |
| `United Kingdom` | Europe/London |
| `Vatican City` | Europe/Vatican |

Outside Europe the same rule holds — a city name from the IANA database, such as `America/New_York` or `Asia/Tokyo`. The full list is `Intl.supportedValuesOf("timeZone")` in any modern runtime.

## Slug

`f.slug()` is a text box shown with the entry's URL prefix in front, such as `/posts/`. It belongs on a collection, and the field must be named `slug`: that is the name the URL is built from, so `collection()` refuses `f.slug()` under any other name.

File: `smoodly/collections.ts`

```ts
export const articles = smoodly.collection({
  name: "articles",
  title: "Articles",
  titleField: "title",
  path: { en: "posts", fi: "artikkelit" },
  // …
  fields: {
    title: f.text().localized(),
    // …
    slug: f.slug({ from: "title" }),
    // …
  },
});
```

The starter passes `from: "title"`: the admin fills the slug from the title as the editor types it, until they type a slug of their own. It stops at the first publish, so a live URL never changes by itself. A slug is tidied when the box loses focus, so `Hello World` becomes `hello-world`, and publish refuses anything that is still not a valid slug. A slug is per language without `.localized()`, because each language has its own URL. Two entries under the same parent cannot share one. Pages have no slug field: a page's slug is set in the admin when it is created and renamed under *Settings*.

Next, [Richtext and elements](https://smoodly.io/docs/fields/richtext.md).
