mirror of
https://github.com/fluxscape/fluxscape.git
synced 2026-01-11 23:02:55 +01:00
fix(runtime): Passing in invalid date to "Date To String" node causes node scope to fail (#75)
This commit is contained in:
@@ -31,8 +31,6 @@ const DateToStringNode = {
|
|||||||
|
|
||||||
this._internal.currentInput = _value;
|
this._internal.currentInput = _value;
|
||||||
this._format();
|
this._format();
|
||||||
this.flagOutputDirty('currentValue');
|
|
||||||
this.sendSignalOnOutput('inputChanged');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -49,10 +47,16 @@ const DateToStringNode = {
|
|||||||
type: 'signal',
|
type: 'signal',
|
||||||
displayName: 'Date Changed',
|
displayName: 'Date Changed',
|
||||||
group: 'Signals'
|
group: 'Signals'
|
||||||
|
},
|
||||||
|
onError: {
|
||||||
|
type: 'signal',
|
||||||
|
displayName: 'Invalid Date',
|
||||||
|
group: 'Signals'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
_format() {
|
_format() {
|
||||||
|
try {
|
||||||
const t = this._internal.currentInput;
|
const t = this._internal.currentInput;
|
||||||
const format = this._internal.formatString;
|
const format = this._internal.formatString;
|
||||||
const date = ('0' + t.getDate()).slice(-2);
|
const date = ('0' + t.getDate()).slice(-2);
|
||||||
@@ -73,6 +77,15 @@ const DateToStringNode = {
|
|||||||
.replace(/\{hours\}/g, hours)
|
.replace(/\{hours\}/g, hours)
|
||||||
.replace(/\{minutes\}/g, minutes)
|
.replace(/\{minutes\}/g, minutes)
|
||||||
.replace(/\{seconds\}/g, seconds);
|
.replace(/\{seconds\}/g, seconds);
|
||||||
|
} catch (error) {
|
||||||
|
// Set the output to be blank, makes it easier to handle.
|
||||||
|
this._internal.dateString = '';
|
||||||
|
this.flagOutputDirty('onError');
|
||||||
|
}
|
||||||
|
|
||||||
|
// Flag that the value have changed
|
||||||
|
this.flagOutputDirty('currentValue');
|
||||||
|
this.sendSignalOnOutput('inputChanged');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user