markers
Description
Optional. Highlights a specified date range in MonthUsage
markers?: (date: Date) => string;
Example
<script setup>
import { Month } from "@svar-ui/vue-core";
const markLine = v =>
v >= new Date(2022, 2, 13) && v <= new Date(2022, 2, 19)
? "inrange"
: "";
</script>
<template>
<Month :current="new Date(2022, 2, 18)" :markers="markLine" />
</template>
Details
The function you pass to markers receives a single argument:
date: Date- the current date cell in the Month. You can use it to check whether this date belongs to a specific range or set of dates.
The function must return:
-
string- the CSS class name to apply for that date cell. -
An empty string ("") if no marker should be applied.
The current property is used to open the calendar at a particular date to make the marked date range visible, if needed.
Related article: Highlighting a date range