Give a new account a first run, and drop to three tabs
Registering used to land you on a bare form asking for a child, with no hint what came next. A short wizard now walks through the child, whether you are planning alone or together, and where the day balances come from: fetched from Försäkringskassan, entered by hand, or skipped — and if skipped, the figures carry a badge saying they are estimates until real ones arrive. Fetching is the first option rather than a hidden one, so the scraper is on by default and the script that used to force it on no longer needs to. Planning and Tips lose their tabs. Authoring moved to the calendar and the figures moved to the overview, so both pages were only a second way to reach what is already on screen; their routes now redirect rather than dead-end. The dead translations went with them. Dates also follow the chosen language now instead of always formatting as Swedish.
This commit is contained in:
@@ -1,16 +1,30 @@
|
||||
/**
|
||||
* Date formatting and calculation utilities for Swedish locale (sv-SE).
|
||||
* All functions use ISO 8601 format for input (YYYY-MM-DD) and Intl API for display.
|
||||
* Date formatting and calculation utilities. Most functions here are
|
||||
* intentionally Swedish-only (weekday/month names, ISO week numbers) since
|
||||
* they back Swedish-specific domain concepts (röd dag names, calendar week
|
||||
* numbers) that don't have an English-locale equivalent in this app.
|
||||
* `formatDateForDisplay` is the exception — it's used for plain "long date"
|
||||
* captions that should follow whichever locale the UI is in, so it takes an
|
||||
* explicit `Locale` (see `@/i18n`) rather than hardcoding `sv-SE`. All
|
||||
* functions use ISO 8601 format for input (YYYY-MM-DD) and Intl API for
|
||||
* display.
|
||||
*/
|
||||
import type { Locale } from '@/i18n'
|
||||
|
||||
const DISPLAY_INTL_LOCALE: Record<Locale, string> = {
|
||||
sv: 'sv-SE',
|
||||
en: 'en-US',
|
||||
}
|
||||
|
||||
/**
|
||||
* Format a date for display (e.g. "1 juni 2026" in Swedish).
|
||||
* Accepts ISO string or Date object.
|
||||
* Format a date for display (e.g. "1 juni 2026" in Swedish, "June 1, 2026"
|
||||
* in English). Accepts ISO string or Date object. Defaults to Swedish for
|
||||
* callers that haven't been updated to pass the active locale.
|
||||
*/
|
||||
export function formatDateForDisplay(date: string | Date): string {
|
||||
export function formatDateForDisplay(date: string | Date, locale: Locale = 'sv'): string {
|
||||
const d = typeof date === 'string' ? new Date(date + 'T00:00:00Z') : date
|
||||
if (!isValidDate(d)) return ''
|
||||
const formatter = new Intl.DateTimeFormat('sv-SE', {
|
||||
const formatter = new Intl.DateTimeFormat(DISPLAY_INTL_LOCALE[locale], {
|
||||
year: 'numeric',
|
||||
month: 'long',
|
||||
day: 'numeric',
|
||||
|
||||
Reference in New Issue
Block a user