Наследую класс и Ерор
Создал основной класс FilterWithoutZero который наслдует от Date
Потом создал еще один клас InputDate который наследуют FilterWithoutZero Почему InputDate не видит toString (я же наследую от Date, там по дефолту прототип Object есть ) Ошибка: Цитата:
class FilterWithoutZero extends Date { constructor(elem) { elem.toString(); if(elem.length == 1) { this.elem = 0+elem; } } } class InputDate extends FilterWithoutZero { getDay = this.getDate().toString(); getMonthSub = this.getMonth()+1; getMonth = this.getMonthSub.toString(); getYear = this.getFullYear(); getMinutes = this.getMinutes().toString(); getHours = this.getHours().toString(); collectDate() { if(this.getDay.length == 1) { this.getDay = 0+this.getDay; } if(this.getMonth.length == 1) { this.getMonth = 0+this.getMonth; } return this.getYear+"-"+this.getMonth+"-"+this.getDay; } collecTime() { if(this.getMinutes.length == 1) { this.getMinutes = 0+this.getMinutes; } if(this.getHours.length == 1) { this.getHours = 0+this.getHours; } return this.getHours+":"+this.getMinutes; } } console.log(new InputDate()); export { FilterWithoutZero, InputDate } |
Часовой пояс GMT +3, время: 18:49. |