diff options
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue b/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue index 0d466df1b7f..7c9a1bcd8cc 100644 --- a/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue +++ b/app/assets/javascripts/vue_shared/components/time_ago_tooltip.vue @@ -1,8 +1,8 @@ <script> import { GlTooltipDirective } from '@gitlab/ui'; +import { DATE_TIME_FORMATS, DEFAULT_DATE_TIME_FORMAT } from '~/lib/utils/datetime_utility'; import timeagoMixin from '../mixins/timeago'; -import '~/lib/utils/datetime_utility'; /** * Port of ruby helper time_ago_with_tooltip @@ -15,7 +15,7 @@ export default { mixins: [timeagoMixin], props: { time: { - type: [String, Number], + type: [String, Number, Date], required: true, }, tooltipPlacement: { @@ -28,10 +28,16 @@ export default { required: false, default: '', }, + dateTimeFormat: { + type: String, + required: false, + default: DEFAULT_DATE_TIME_FORMAT, + validator: (timeFormat) => DATE_TIME_FORMATS.includes(timeFormat), + }, }, computed: { timeAgo() { - return this.timeFormatted(this.time); + return this.timeFormatted(this.time, this.dateTimeFormat); }, }, }; |