Every line of 'bootstrap datetimepicker set default date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
144 makeCustomPicker(defaultValue) { 145 //自定义过滤 146 const disabledWeek = (current) => current && current.valueOf() > Date.now() - DAYTIMES; 147 // 周数据 148 const customPicker = ( 149 this.handleRangePickerChange(date, dateString, 'custom')} 150 /> 151 ); 152 return customPicker; 153 }
285 getDate() { 286 return new Date(this.date.getTime()); 287 }
50 select(date: Date) { 51 // Get the selected date from the date/time pickers. 52 // This date would be local to the timezone that was selected, 53 // so it must first be offsetted back to UTC. 54 this.$emit('input', date.getTime() - this.tzOffset); 55 }
11 setTime(date){ 12 this.refs.datePickerComponent.setTime(date); 13 }
109 public setDay(date:number):void { 110 this.dateTime = moment(this.dateTime).date(date).format(this.dateTimeFormat); 111 }
222 setDate(day) { 223 const oldDateValue = this.target.value; 224 const dayOfWeek = new Date(this.current.year, this.current.month, day).getDay(); 225 const date = this.options.outputFormat 226 .replace('%a', this.options.weekdays.short[dayOfWeek]) 227 .replace('%A', this.options.weekdays.long[dayOfWeek]) 228 .replace('%d', (`0${day}`).slice(-2)) 229 .replace('%e', day) 230 .replace('%b', this.options.months.short[this.current.month]) 231 .replace('%B', this.options.months.long[this.current.month]) 232 .replace('%m', (`0${this.current.month + 1}`).slice(-2)) 233 .replace('%w', dayOfWeek) 234 .replace('%Y', this.current.year); 235 this.target.value = date; 236 237 if (date !== oldDateValue) { 238 if ('createEvent' in document) { 239 const changeEvent = document.createEvent('HTMLEvents'); 240 changeEvent.initEvent('change', false, true); 241 this.target.dispatchEvent(changeEvent); 242 } else { 243 this.target.fireEvent('onchange'); 244 } 245 } 246 }
114 private set initDate(value:Date) { 115 this._initDate = value; 116 }
221 setToNow(): void { 222 223 if (this._isRangeMode) { 224 const date = new Date(); 225 226 if (this._isRangeStart && !this._rangeService.showTime) { 227 this.datepicker.setDate(date.getDate(), date.getMonth(), date.getFullYear(), 0, 0, 0); 228 } else if (this._isRangeEnd && !this._rangeService.showTime) { 229 this.datepicker.setDate(date.getDate(), date.getMonth(), date.getFullYear(), 23, 59, 59); 230 } else { 231 this.datepicker.setDate(date.getDate(), date.getMonth(), date.getFullYear(), this.datepicker.hours, this.datepicker.minutes, this.datepicker.seconds); 232 } 233 } else { 234 // set the date to the current moment 235 this.datepicker.setDateToNow(); 236 } 237 }
17 public openDate() { 18 this.isOpen = true; 19 if (this.dt == null) { 20 this.dt = new Date(); 21 this.triggerChangeEvent(); 22 } 23 }
162 private setDefaultTime(time: string): void { 163 this.timepickerService.setDefaultTimeIfAvailable( 164 time, this.minTime, this.maxTime, this.format, this.minutesGap); 165 }