Skip to content

feat: Hide today mark on calendar #8

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@ import type {
| placeholder | no | `string` | `undefined` |
| locale | no | [DayjsLocale](https://cdn.jsdelivr.net/npm/dayjs@1/locale.json) (union type of key values from the link) | `"en"` |
| start-week-on-monday | no | `boolean` | `false` |
| hide-today-mark | no | `boolean` | `false` |
| clearable | no | `boolean` | `true` |
| disabled | no | `boolean` | `false` |
| error | no | `boolean` | `false` |
@@ -271,6 +272,14 @@ type CalendarStylesProp = {
- `leftHeaderButtonIcon` (Calendar left header button icon)
- `rightHeaderButtonIcon` (Calendar right header button icon)

## Supporting the project

Maintaining an open-source project is a time-consuming job. Your support is very appreciated ❤️

Please ⭐️ this repository if you like the component.

You can also make a financial contribution via sponsoring this project or one time donation → [become a sponsor](https://github.com/sponsors/softechub-ib).

## License

Copyright © 2024-present [softechub-ib](https://github.com/softechub-ib)
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@softechub-ib/vue-datepicker",
"version": "1.0.14",
"version": "1.0.15",
"description": "Datepicker component for Vue 3",
"author": "softechub-ib",
"private": false,
8 changes: 6 additions & 2 deletions src/components/VueCalendar.vue
Original file line number Diff line number Diff line change
@@ -21,6 +21,7 @@ type VueCalendarProps = {
monthPicker: boolean;
yearPicker: boolean;
startWeekOnMonday: boolean;
hideTodayMark: boolean;
min: DateString | undefined;
max: DateString | undefined;
styles: DeepRequired<CalendarStylesProp>;
@@ -506,7 +507,7 @@ watch(
:class="{
'sib-calendar__table__body__item--offset': item.offset,
'sib-calendar__table__body__item--current':
item.date === currentDate,
!props.hideTodayMark && item.date === currentDate,
'sib-calendar__table__body__item--restricted': isDayRestricted(
item.date,
),
@@ -555,6 +556,7 @@ watch(
class="sib-calendar__table__body__item sib-calendar__table__body__item--months"
:class="{
'sib-calendar__table__body__item--current':
!props.hideTodayMark &&
props.monthPicker &&
`${year}-${item.value}` === formatDate(currentDate, 'YYYY-MM'),
'sib-calendar__table__body__item--restricted': isMonthRestricted(
@@ -610,7 +612,9 @@ watch(
class="sib-calendar__table__body__item sib-calendar__table__body__item--years"
:class="{
'sib-calendar__table__body__item--current':
props.yearPicker && item === formatDate(currentDate, 'YYYY'),
!props.hideTodayMark &&
props.yearPicker &&
item === formatDate(currentDate, 'YYYY'),
'sib-calendar__table__body__item--restricted':
isYearRestricted(item),
'sib-calendar__table__body__item--selected': isYearSelected(item),
3 changes: 3 additions & 0 deletions src/components/VueDatePicker.vue
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ type VueDatePickerProps = {
placeholder?: string;
locale?: DayjsLocale;
startWeekOnMonday?: boolean;
hideTodayMark?: boolean;
clearable?: boolean;
disabled?: boolean;
error?: boolean;
@@ -50,6 +51,7 @@ const props = withDefaults(defineProps<VueDatePickerProps>(), {
placeholder: undefined,
locale: 'en',
startWeekOnMonday: false,
hideTodayMark: false,
clearable: true,
disabled: false,
error: false,
@@ -280,6 +282,7 @@ watch(
:month-picker="props.monthPicker"
:year-picker="props.yearPicker"
:start-week-on-monday="props.startWeekOnMonday"
:hide-today-mark="props.hideTodayMark"
:min="props.min ? formatDate(props.min, 'YYYY-MM-DD') : undefined"
:max="props.max ? formatDate(props.max, 'YYYY-MM-DD') : undefined"
:styles="mergedCalendarStyles"
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -19,6 +19,7 @@ type VueDatePickerProps = {
placeholder?: string;
locale?: DayjsLocale;
startWeekOnMonday?: boolean;
hideTodayMark?: boolean;
clearable?: boolean;
disabled?: boolean;
error?: boolean;
@@ -69,6 +70,7 @@ declare const __VLS_component: import('vue').DefineComponent<
monthPicker: boolean;
yearPicker: boolean;
startWeekOnMonday: boolean;
hideTodayMark: boolean;
min: string | number | Date | null;
max: string | number | Date | null;
disabled: boolean;
Loading