Skip to content
Discussion options

You must be logged in to vote

The children snippet of RangeCalendar.Root exposes months, and the visible bounds are its ends. Each month object carries its rendered weeks, including the leading and trailing cells that belong to the neighbouring months, so the first cell of the first week and the last cell of the last week are exactly what the user sees:

<RangeCalendar.Root bind:placeholder>
	{#snippet children({ months, weekdays })}
		{@const firstVisible = months[0].weeks[0][0]}
		{@const lastVisible = months.at(-1).weeks.at(-1).at(-1)}
		<!-- render the calendar as usual -->
	{/snippet}
</RangeCalendar.Root>

The cells are @internationalized/date objects, so firstVisible.toString() gives you an ISO date for the backe…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by vbackeberg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants