Skip to content

Added option for initialDates#558

Merged
fetrarij merged 1 commit intofetrarij:masterfrom
mustafashykh:master
Aug 8, 2025
Merged

Added option for initialDates#558
fetrarij merged 1 commit intofetrarij:masterfrom
mustafashykh:master

Conversation

@mustafashykh
Copy link
Copy Markdown
Contributor

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.

@fetrarij fetrarij merged commit a9d111a into fetrarij:master Aug 8, 2025
@fetrarij
Copy link
Copy Markdown
Owner

fetrarij commented Aug 8, 2025

Thanks @mustafashykh

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.

2 participants