mirror of
https://github.com/kestra-io/kestra.git
synced 2025-12-19 18:05:41 -05:00
fix(dashboard): avoid undefined Date being mapped to current date
This commit is contained in:
@@ -16,5 +16,13 @@
|
||||
});
|
||||
|
||||
const format = localStorage.getItem(DATE_FORMAT_STORAGE_KEY) ?? "llll";
|
||||
const date = computed(() => moment(props.field)?.format(format) ?? props.field);
|
||||
const formatDateIfPresent = (rawDate: string|undefined) => {
|
||||
if(rawDate){
|
||||
// moment(date) always return a Moment, if the date is undefined, it will return current date, we don't want that here
|
||||
return moment(rawDate).format(format) ?? props.field;
|
||||
} else {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
const date = computed(() => formatDateIfPresent(props.field));
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user