ha-clockwork-card icon indicating copy to clipboard operation
ha-clockwork-card copied to clipboard

Error when no other clocks are defined

Open to-scho opened this issue 5 years ago • 1 comments

Please add handling of use case when no other clocks are given. E.g.

       var otherclocks = ``;
        if (_other_timezones) {
			//Build List of Other Timezones
			//
			otherclocks = otherclocks + `
				<div class = "other_clocks">
				`;
			var i;
			var j = _other_timezones.length; //TODO: Recommend max 3.
			for (i= 0; i < j; i++) {
				//Format other timezones.
				var _tztime = _date_time.toLocaleTimeString(_locale, {
					hour: 'numeric',
					minute: 'numeric',
					timeZone: _other_timezones[i],
					weekday: 'short'
				}); 
			
				// List other Timezones.
				otherclocks = otherclocks + `
					<div class="tz_locale">${_other_timezones[i]} </div> 
					<div class="otime"> ${_tztime} </div>
				`;
				//console.log(_tztime);
			};
			otherclocks = otherclocks + `
				</div>
				`;
			/*console.log(otherclocks);*/
		} 

to-scho avatar Feb 16 '20 14:02 to-scho

how to use this?

rumunn95 avatar Nov 07 '21 11:11 rumunn95