mirror of https://github.com/nocodb/nocodb
Pranav C
3 years ago
5 changed files with 70 additions and 3 deletions
@ -0,0 +1,19 @@
|
||||
<template> |
||||
<span>{{ date }}</span> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'DateCell', |
||||
props: ['value'], |
||||
computed: { |
||||
date() { |
||||
return typeof this.value === 'string' ? this.value.replace(/(\d)T(?=\d)/, '$1 ').replace(/\s\d{2}:\d{2}:[\d:.]+z?$/i, '') : (this.value && new Date(this.value)) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,23 @@
|
||||
<template> |
||||
<span>{{ dateTime }}</span> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'DateTimeCell', |
||||
props: ['value'], |
||||
computed: { |
||||
dateTime() { |
||||
if (/^\d{6,}$/.test(this.value)) { |
||||
return new Date(+this.value) |
||||
} |
||||
|
||||
return /\dT\d/.test(this.value) ? new Date(this.value.replace(/(\d)T(?=\d)/, '$1 ')) : ((this.value && new Date(this.value))) |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
@ -0,0 +1,19 @@
|
||||
<template> |
||||
<span>{{ time }}</span> |
||||
</template> |
||||
|
||||
<script> |
||||
export default { |
||||
name: 'TimeCell', |
||||
props: ['value'], |
||||
computed: { |
||||
time() { |
||||
return typeof this.value === 'string' ? this.value.replace(/(\d)T(?=\d)/, '$1 ') : this.value |
||||
} |
||||
} |
||||
} |
||||
</script> |
||||
|
||||
<style scoped> |
||||
|
||||
</style> |
Loading…
Reference in new issue