render() {
        this.reset()

        if (this.lang == "FR") {
            this.toggleFR()
        }

        // Create offset days
        for (let i = 0; i < this.firstDayOfTheWeek; i++) {
            let newDay = document.createElement('div')
            this.date_content.appendChild(newDay)
            this.days.push(newDay)
        }
        // Create days
        for (let i = 0; i < this.nbDaysInMonth(this.date.getMonth(), this.date.getFullYear()); i++) {
            let newDay = document.createElement('div')
            newDay.innerHTML = `${i+1}`
            newDay.classList.add('gus_dp_day')
            if (this.date.getMonth() === this.selected_date.getMonth() && this.date.getFullYear() === this.selected_date.getFullYear() && i + 1 === this.selected_date.getDate()) {
                newDay.classList.add('gus_dp_actual_day')
            }
            newDay.addEventListener('click', (e) => {
                let nbDay = parseInt(e.target.innerHTML)
                this.selected_date = new Date(this.date.setDate(nbDay))
                this.dispatchEvent(this.event_date_changed);
                this.render()
            })
            this.days.push(newDay)
            this.date_content.appendChild(newDay)
        }
        // Set the selected date
        this.date_selected.innerHTML = `${this.selected_date.toDateString().substring(0, 3)}, ${this.selected_date.toDateString().substring(4, 7)} ${this.date.getDate()}`
        // Set the selected year
        this.year_selected.innerHTML = `${this.getMonthFromNumber(this.date.getMonth())} ${this.date.getFullYear()}`
    }
// Re-render the whole date-picker
Re-render the whole date-picker
Re - render the whole date - picker
render() {
        this.reset()
        if (this.lang == "FR") {
            this.toggleFR()
        }
        for (let i = 0; i < this.firstDayOfTheWeek; i++) {
            let newDay = document.createElement('div')
            this.date_content.appendChild(newDay)
            this.days.push(newDay)
        }
        for (let i = 0; i < this.nbDaysInMonth(this.date.getMonth(), this.date.getFullYear()); i++) {
            let newDay = document.createElement('div')
            newDay.innerHTML = `${i+1}`
            newDay.classList.add('gus_dp_day')
            if (this.date.getMonth() === this.selected_date.getMonth() && this.date.getFullYear() === this.selected_date.getFullYear() && i + 1 === this.selected_date.getDate()) {
                newDay.classList.add('gus_dp_actual_day')
            }
            newDay.addEventListener('click', (e) => {
                let nbDay = parseInt(e.target.innerHTML)
                this.selected_date = new Date(this.date.setDate(nbDay))
                this.dispatchEvent(this.event_date_changed);
                this.render()
            })
            this.days.push(newDay)
            this.date_content.appendChild(newDay)
        }
        this.date_selected.innerHTML = `${this.selected_date.toDateString().substring(0, 3)}, ${this.selected_date.toDateString().substring(4, 7)} ${this.date.getDate()}`
        this.year_selected.innerHTML = `${this.getMonthFromNumber(this.date.getMonth())} ${this.date.getFullYear()}`
    }
render ( ) { this . reset ( ) if ( this . lang == "FR" ) { this . toggleFR ( ) } for ( let i = 0 ; i < this . firstDayOfTheWeek ; i ++ ) { let newDay = document . createElement ( 'div' ) this . date_content . appendChild ( newDay ) this . days . push ( newDay ) } for ( let i = 0 ; i < this . nbDaysInMonth ( this . date . getMonth ( ) , this . date . getFullYear ( ) ) ; i ++ ) { let newDay = document . createElement ( 'div' ) newDay . innerHTML = ` ${ i + 1 } ` newDay . classList . add ( 'gus_dp_day' ) if ( this . date . getMonth ( ) === this . selected_date . getMonth ( ) && this . date . getFullYear ( ) === this . selected_date . getFullYear ( ) && i + 1 === this . selected_date . getDate ( ) ) { newDay . classList . add ( 'gus_dp_actual_day' ) } newDay . addEventListener ( 'click' , ( e ) => { let nbDay = parseInt ( e . target . innerHTML ) this . selected_date = new Date ( this . date . setDate ( nbDay ) ) this . dispatchEvent ( this . event_date_changed ) ; this . render ( ) } ) this . days . push ( newDay ) this . date_content . appendChild ( newDay ) } this . date_selected . innerHTML = ` ${ this . selected_date . toDateString ( ) . substring ( 0 , 3 ) } ${ this . selected_date . toDateString ( ) . substring ( 4 , 7 ) } ${ this . date . getDate ( ) } ` this . year_selected . innerHTML = ` ${ this . getMonthFromNumber ( this . date . getMonth ( ) ) } ${ this . date . getFullYear ( ) } ` }
Re-render the whole date-picker
Re - render the whole date - picker
// Create offset days // Create days // Set the selected date // Set the selected year