Topic: how to update the json key "disableSince" for my datepicker?
                  
                  yeisonvelez11
                  free
                  asked 6 years ago
                
I'm trying to update the json field "disableSince" when the date is changed. but the calendar is the same, I do not see any change. How can I do it?
<mdb-date-picker name="fecha_estimada_fin" id="fecha_estimada_fin" [options]="opciones_fecha_fin" placeholder="Fecha Estimada de Fin" (dateChanged)="fn_limitStartDate()" formControlName="fecha_estimada_fin" mdbInput mdbValidate mdbInputDirective class="calendario" ></mdb-date-picker>
public opciones_fecha_fin: IMyOptions;
this.opciones_fecha_fin={
datepicker: {
// Strings and translations
dayLabels: {su: 'Dom', mo: 'Lun', tu: 'Mar', we: 'Mie', th: 'Jue', fr: 'Vie', sa: 'Sab'},
dayLabelsFull: {su: "Domingo", mo: "Lunes", tu: "Martes", we: "Miércoles", th: "Jueves", fr: "Viernes", sa:
"Sabado"},
monthLabels: { 1: 'Ene', 2: 'Feb', 3: 'Mar', 4: 'Abr', 5: 'May', 6: 'Jun', 7: 'Jul', 8: 'Ago', 9: 'Sep', 10:
'Oct', 11: 'Nov', 12: 'Dic' },
monthLabelsFull: { 1: "Enero", 2: "Febrero", 3: "Marzo", 4: "Abril", 5: "May", 6: "Junio", 7: "Julio", 8:
"Agosto", 9: "Septiembre", 10: "Octubre", 11: "Noviembre", 12: "Diciembre" },
// Buttons
todayBtnTxt: "Hoy",
clearBtnTxt: "Borrar",
closeBtnTxt: "Cerrar",
// Format
dateFormat: 'yyyy/mm/dd',
// First day of the week
firstDayOfWeek: 'Lun',
// // Disable dates
/*disableUntil: {year: 2018, month: 10, day: 1},
disableSince: {year: 2018, month: 10, day: 31},/*
disableDays: [{year: 2018, month: 10, day: 3}],*/
//disableDateRanges: [{begin: {year: 2018, month: 10, day: 5}, end: {year: 2018, month: 10, day: 7}}],
disableWeekends: false,
// Enable dates (when disabled)
// Year limits
minYear: 2017,
maxYear: 9999,
// Show Today button
showTodayBtn: true,
// Show Clear date button
showClearDateBtn: true,
markCurrentDay: true,
//markDates: [{dates: [{year: 2018, month: 10, day: 20}], color: '#303030'}],
markWeekends: undefined,
disableHeaderButtons: false,
showWeekNumbers: false,
height: '100px',
width: '90%',
selectionTxtFontSize: '15px'
}
};
fn_limitStartDate(){
setTimeout(()=>{
let fec_fin=this.ValidacionCrearEntregable.controls['fecha_estimada_fin'].value;
let aFec_fin=fec_fin.split("/");
console.log(aFec_fin);
this.opciones_fecha_fin.disableSince= {year: aFec_fin[0], month: aFec_fin[1], day: aFec_fin[2]};
})
}
                      
                        Add comment
                      
                    
                  
                
                      
                      Arkadiusz Idzikowski
                      staff
                        answered 6 years ago
                    
You need to use spread operator, for example:
this.myDatePickerOptions = {...this.myDatePickerOptions, disableSince: { year: 2018, month: 12, day: 29 }};FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Status
              Resolved
Specification of the issue
              - ForumUser: Free
 - Premium support: No
 - Technology: MDB Angular
 - MDB Version: 7.0.0
 - Device: web
 - Browser: chrome
 - OS: windows 10
 - Provided sample code: Yes
 - Provided link: No