Topic: Data structure incomplete for timepicker?

Starceaker free asked 7 years ago


Dear MDB

On the following page I see ngModel being bound to properties that are not mentioned in the datastructure section:

https://mdbootstrap.com/angular/advanced/timepicker/#options

While testing your timepicker I notice that the initial value I give my string property (for example: 15:00) is not taken into account when opening the timepicker. It shows 12:00 as a first selection. After that the selection is correctly shown when opening the timepicker.


Rafał Rogulski free commented 7 years ago

Thanks, for report this bug we will fix it in next release.

Dawid Adach pro answered 7 years ago


Dear Starceaker , you can set initial value for time picker using ViewChild and AfterViewInit.
Within your component.ts file import
import { Component, OnInit, ViewChild, AfterViewInit} from '@angular/core';
then, initialize variable i.e.:
@ViewChild("darkPicker") darkPicker: ClockPickerComponent;
make sure to add darkPicker id to you html element like this:
<mdb-time-picker #darkPicker [twelvehour]="false" [darktheme]="true"
[placeholder]="'Selected time'" [label]="'Dark version, 24hours'" [ngModel]="darkClock"></mdb-time-picker>
Finally, you can user .setHour and .setMinute and .setAmPm functions to set your time.
ngAfterViewInit(){
setTimeout(() => this.darkPicker.setHour("15"), 0);
}

Starceaker free commented 7 years ago

Thank you, I will look into this.

Starceaker free answered 7 years ago


Dear Rafal By now we went from 4.3.1 to 4.3.5 and the https://mdbootstrap.com/angular/advanced/timepicker/ page still doesn't contain the example. Could you let me know in which release you plan on adding this? The same question goes for my other more blocking question: https://mdbootstrap.com/support/timepicker-twelvehours-false-doesnt-show-24-hour-notation-in-the-upper-textbox/ Kind regards

Please insert min. 20 characters.

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: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags