Open Closed

[Form Prop Extension] - ePropType.Date #6554


User avatar
0
trannguyenphucanh created
  • ABP Framework version: v5.3.3
  • UI Type: Angular
  • Database System: EF Core (MySQL)
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes
  • Exception message and full stack trace:
  • Steps to reproduce the issue:

Hi Support Team,

I am extending 2 more date fields to the form. I would like to ask if there a way to limit max date selection in the UI:

For example, the dates from 24th January onward should be greyed out & disabled, this could be done in other components with NgbInputDatepicker.maxDate. Is there a way to achieved similarly?

Hope to hear from you guys soon.


4 Answer(s)
  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi,

    please check similar issue https://support.abp.io/QA/Questions/1464/Date-Field-Restrictions-and-Format

    please let me know if found helpful

    thanks

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hello,

    Please try with this code

    Add in .html file <input readonly id="book-date" formControlName="date" class="form-control" [maxDate]="maxDate" ngbDatepicker #dateInput="ngbDatepicker" (click)="dateInput.open()" />

    Add in.ts file

    currentdate = new Date(); day = this.currentdate.getDate(); month = this.currentdate.getMonth() + 1; year = this.currentdate.getFullYear(); maxDate: NgbDateStruct = { year: this.year, month: this.month, day: this.day };

    and add this package import { NgbDateStruct } from '@ng-bootstrap/ng-bootstrap';

    which will results like

    thanks

  • User Avatar
    0
    trannguyenphucanh created

    Hi, could I ask what is the selector and templateUrl values of the popup? I want to try interfering with the HTML element directly by using angular ngAfterViewInitto see if it works.

  • User Avatar
    0
    Anjali_Musmade created
    Support Team Support Team Member

    Hi , Please check this

    Thanks,

Made with ❤️ on ABP v8.2.0-preview Updated on March 25, 2024, 15:11