mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-12-20 10:11:21 +00:00
@@ -92,13 +92,18 @@ export default {
|
||||
},
|
||||
timeStr: {
|
||||
get() {
|
||||
// console.log('getTimeStr: ' + this.localTime);
|
||||
if (this.localTime instanceof Date && !isNaN(this.localTime)) {
|
||||
return ('0' + this.localTime.getHours()).slice(-2) + ':' + ('0' + this.localTime.getMinutes()).slice(-2) + ':' + ('0' + this.localTime.getSeconds()).slice(-2);
|
||||
let localStr = ('0' + this.localTime.getHours()).slice(-2) + ':' + ('0' + this.localTime.getMinutes()).slice(-2) + ':' + ('0' + this.localTime.getSeconds()).slice(-2);
|
||||
// console.log('Time is: ' + localStr);
|
||||
return localStr;
|
||||
}
|
||||
return '';
|
||||
},
|
||||
set(value) {
|
||||
// console.log('Set: ' + value);
|
||||
if ('' === value) {
|
||||
// console.log('Value is empty, set 00:00:00');
|
||||
this.localTime.setHours(0);
|
||||
this.localTime.setMinutes(0);
|
||||
this.localTime.setSeconds(0);
|
||||
@@ -108,9 +113,11 @@ export default {
|
||||
// bit of a hack but meh.
|
||||
let current = new Date(this.localTime.getTime());
|
||||
let parts = value.split(':');
|
||||
current.setHours(parseInt(parts[0]));
|
||||
current.setMinutes(parseInt(parts[1]));
|
||||
current.setSeconds(parseInt(parts[2]));
|
||||
// console.log('Parts are:');
|
||||
// console.log(parts);
|
||||
current.setHours(parseInt(parts[0] ?? 0));
|
||||
current.setMinutes(parseInt(parts[1] ?? 0));
|
||||
current.setSeconds(parseInt(parts[2] ?? 0));
|
||||
this.localTime = current;
|
||||
this.$emit('set-time', {time: this.localTime});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user