Skip to content

@deltares/fews-web-oc-composables


@deltares/fews-web-oc-composables / useDateRegistry

Function: useDateRegistry() ​

useDateRegistry(dates): void

Defined in: useDateRegistry/index.ts:93

Beta

Registers a Date[] ref (or getter) with the nearest ancestor createDateRegistry registry, so its dates are included in the registry's combined dates. The dates are unregistered automatically when the calling component or effect scope is disposed.

Does nothing if no ancestor registry was created.

Parameters ​

dates ​

DateRefOrGetter

The reactive ref, or getter function, returning the Date[] to register.

Returns ​

void

Example ​

ts
// ChildComponent.vue
import { ref } from 'vue'
import { useDateRegistry } from '@deltares/fews-web-oc-composables'

const dates = ref<Date[]>([new Date('2024-01-01'), new Date('2024-01-02')])
useDateRegistry(dates)