When referencing the Clarity Design documentation for datepicker at this link, it is mentioned in the last section titled Summary of Options
that the format for [max]
should be in YYYY-MM-DD
.
In the code snippet below, I have set the maxDateLimit
to the same format. However, upon running the code, I encountered the error logs as shown in the screenshot.
Am I incorrectly using the YYYY-MM-DD
format? Please advise on why this error is occurring and how to rectify it.
Code:
private onSatelliteTimeRangeFromSet(event:any):void {
console.log(this.debugTag,"dateOfSpray: ", this.iDatePasser.dateOfSpray)
const splitted = this.iDatePasser.dateOfSpray.split('/')
const numOfDateBites = splitted.length
this.maxDateLimit = this.datePipe.transform(new Date(), 'YYYY-MM-DD') as string
const maxDateLimitAsDate = new Date(this.maxDateLimit)
const dateOfSprayAsDate = new Date(this.iDatePasser.dateOfSpray)
const maxDateDate = maxDateLimitAsDate.getDate()
const maxDateMonth = maxDateLimitAsDate.getMonth()
const maxDateYear = maxDateLimitAsDate.getFullYear()
console.log(this.debugTag,"maxDateLimit: ", this.maxDateLimit)
Logs: