Skip to content
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

Added option for initialDates #558

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mustafashykh
Copy link

Add Initial Calendar View Date Support

Description

Added the ability to set initial calendar view dates without pre-selecting them. This enhancement allows users to specify which months should be displayed in the left and right calendars when the date picker first opens, without affecting the date selection.

New Features

  • Added initialDates input property that accepts an array of two dates [leftCalendarDate, rightCalendarDate]
  • Supports both string dates and dayjs objects as input
  • Maintains existing date selection functionality
  • Falls back to current month and next month if no initial dates are provided

Usage Example

<ngx-daterangepicker-material [initialDates]="['2024-01-01', '2024-02-01']" >
</ngx-daterangepicker-material>

Changes Made

  • Updated daterangepicker.component.ts to handle initial dates
  • Updated daterangepicker.directive.ts to pass through the new property
  • Maintained backward compatibility with existing functionality

Testing

  • Tested with string dates
  • Tested with dayjs objects
  • Verified that date selection works as expected
  • Verified fallback behavior when no initial dates are provided

Breaking Changes

None. This is a non-breaking enhancement that maintains full backward compatibility.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant