useDate

Commons
stable

Injects the configured date adapter instance. Reads the date options provided by createOrigam() (or a parent OrigamDateProvider) and returns a ready-to-use adapter that abstracts all date arithmetic. Throws if called outside an app context where date options are not provided.

API

Signature

Signature TypeScript complète extraite du fichier du composable.

typescript

useDate() must be called inside a component tree where date options have been registered (via createOrigam({ date: { adapter: DateAdapter } }) or a parent OrigamDateProvider). It throws with a clear message if the injection key is missing.

Interfaces consommées

IDateOptions
ILocaleInstance

API

Valeurs de retour

Propriétés et méthodes exposées par l'objet retourné par le composable.

(adapter instance)
The configured DateAdapter instance. Exposes methods for date creation, comparison, formatting, arithmetic (addDays, startOfMonth, endOfMonth, …) and locale-aware calendar generation (getWeekArray).

Usage

Exemples

Extraits de code prêts à coller.

Format today's date

vue

Compute the week array for the current month

vue