Time picker variable type in catalog item

poco
Tera Contributor

Hi All 

 

i want to create a Time picker variable type in catalog form for that i configured widget it's working fine as time picker but i want to set default time as 12:00 AM. Default time was not working please help for this.

 

For HTML template :
<div class= "time-picker-container">
<label for = "timeInput">Event End Time :</label>
<input
id="timeInput"
type ="time"
ng-model= "c.data.timeValue"
class = "form-control"
required
/>
</div>
 
client controller :
 
api.controller = function() {
    /* widget controller */
    var c = this;
    if (!c.data.timeValue) {
        c.data.timeValue = '00:00';
    }
    c.$watch('c.data.timeValue', function(newValue, oldValue) {
        if (newValue !== oldValue) {
            console.log('Time selected:', newValue);
        }
    });
};
 
server side :
 
(function() {
    var c = this;
    c.data.timeValue = c.timeValue || '00:00';
 
i used above script for time picker configuration 


})();
 
 
 
 

 

 

 

 

 

1 ACCEPTED SOLUTION

Harsh Vardhan
Giga Patron

@poco  Try to use value parameter in html script.

 

HTML Updated script:

 

<div class= "time-picker-container">
<label for = "timeInput">Event End Time :</label>
<input
id="timeInput"
type ="time"
ng-model= "c.data.timeValue"
class = "form-control"
required
value = "00:00"
       
/>
</div>

 

Reference: 

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time 

 

Thanks,

Harsh

View solution in original post

1 REPLY 1

Harsh Vardhan
Giga Patron

@poco  Try to use value parameter in html script.

 

HTML Updated script:

 

<div class= "time-picker-container">
<label for = "timeInput">Event End Time :</label>
<input
id="timeInput"
type ="time"
ng-model= "c.data.timeValue"
class = "form-control"
required
value = "00:00"
       
/>
</div>

 

Reference: 

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/time 

 

Thanks,

Harsh