/** Adapts type `D` to be usable as a date by cdk-based components that work with dates. */ export abstract class SbbDateAdapter < D > { /** The locale to use for all dates. */ protected _locale : any ; param date returns abstract getYear ( date ) ; param date returns abstract getMonth ( date ) ; param date returns abstract getDate ( date ) ; param date returns abstract getDayOfWeek ( date ) ; abstract getMonthName ( date ) ; param style returns abstract getMonthNames ( style ) ; returns abstract getDateNames ( ) ; param style returns abstract getDayOfWeekNames ( style ) ; param date returns abstract getYearName ( date ) ; returns abstract getFirstDayOfWeek ( ) ; param date returns abstract getNumDaysInMonth ( date ) ; param date returns abstract clone ( date ) ; param year param month param date returns abstract createDate ( year , month , date ) ; returns abstract today ( ) ; param value returns abstract parse ( value ) ; param date param displayFormat returns abstract format ( date , displayFormat ) ; param date param years returns abstract addCalendarYears ( date , years ) ; param date param months returns abstract addCalendarMonths ( date , months ) ; param date param days returns abstract addCalendarDays ( date , days ) ; param date returns abstract toIso8601 ( date ) ; param obj returns abstract isDateInstance ( obj ) ; param date returns abstract isValid ( date ) ; returns abstract invalid ( ) ; param value returns deserialize ( value ) { if ( value == null || ( this . isDateInstance ( value ) && this . isValid ( value ) ) ) { return value ; } return this . invalid ( ) ; } param locale setLocale ( locale ) { this . _locale = locale ; } param first param second returns compareDate ( first , second ) { return ( this . getYear ( first ) - this . getYear ( second ) || this . getMonth ( first ) - this . getMonth ( second ) || this . getDate ( first ) - this . getDate ( second ) ) ; } param first param second returns sameDate ( first , second ) { if ( first && second ) { const firstValid = this . isValid ( first ) ; const secondValid = this . isValid ( second ) ; if ( firstValid && secondValid ) { return ! this . compareDate ( first , second ) ; } return firstValid === secondValid ; } return first === second ; } param date param min param max returns clampDate ( date , min ? , max ? ) { if ( min && this . compareDate ( date , min ) < 0 ) { return min ; } if ( max && this . compareDate ( date , max ) > 0 ) { return max ; } return date ; } }