Commit 37673ee7 authored by Fatih Acet's avatar Fatih Acet

Merge branch '8946-account-expiration-date-time-discrepancy' into 'master'

Resolve "Account expiration date/time discrepancy"

Closes #8946

See merge request gitlab-org/gitlab-ee!9166
parents 921bae09 2751af68
......@@ -33,7 +33,10 @@ export default {
},
getDisplayValue(col) {
if (col.isDate && col.value) {
return dateInWords(new Date(col.value));
const [year, month, day] = col.value.split('-');
// create UTC date (prevent date from being converted to local timezone)
return dateInWords(new Date(year, month - 1, day));
}
// let's display '-' instead of 0 for the 'Free' plan
......
---
title: Create UTC date in subscription table
merge_request: 9166
author:
type: fixed
import Vue from 'vue';
import { dateInWords } from '~/lib/utils/datetime_utility';
import component from 'ee/billings/components/subscription_table_row.vue';
import mountComponent from 'spec/helpers/vue_mount_component_helper';
......@@ -76,5 +77,28 @@ describe('Subscription Table Row', () => {
expect(currentCol.querySelector('.btn-help')).not.toBe(null);
});
describe('date column', () => {
const dateColumn = {
id: 'c',
label: 'Column C',
value: '2018-01-31',
isDate: true,
};
beforeEach(() => {
props = { header, columns: [dateColumn] };
vm = mountComponent(Component, props);
});
it('should render the date in UTC', () => {
const currentCol = vm.$el.querySelectorAll('.grid-cell:not(.header-cell)')[0];
const d = dateColumn.value.split('-');
const outputDate = dateInWords(new Date(d[0], d[1] - 1, d[2]));
expect(currentCol.querySelector('.property-label').textContent).toContain(dateColumn.label);
expect(currentCol.querySelector('.property-value').textContent).toContain(outputDate);
});
});
});
});
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment