Add latest changes from gitlab-org/gitlab@master
This commit is contained in:
parent
2abb1b54c0
commit
d4633b0e70
3 changed files with 16 additions and 7 deletions
|
@ -555,5 +555,9 @@ export const calculateRemainingMilliseconds = endDate => {
|
|||
* @param {number} daysInPast number of days that are subtracted from a given date
|
||||
* @returns {String} Date string in ISO format
|
||||
*/
|
||||
export const getDateInPast = (date, daysInPast) =>
|
||||
new Date(date.setTime(date.getTime() - daysInPast * 24 * 60 * 60 * 1000)).toISOString();
|
||||
export const getDateInPast = (date, daysInPast) => {
|
||||
const dateClone = newDate(date);
|
||||
return new Date(
|
||||
dateClone.setTime(dateClone.getTime() - daysInPast * 24 * 60 * 60 * 1000),
|
||||
).toISOString();
|
||||
};
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
.row
|
||||
.col-sm-9
|
||||
= form_tag admin_runners_path, id: 'runners-search', method: :get, class: 'filter-form js-filter-form' do
|
||||
.filtered-search-wrapper
|
||||
.filtered-search-wrapper.d-flex
|
||||
.filtered-search-box
|
||||
= dropdown_tag(custom_icon('icon_history'),
|
||||
options: { wrapper_class: 'filtered-search-history-dropdown-wrapper',
|
||||
|
|
|
@ -428,11 +428,16 @@ describe('newDate', () => {
|
|||
});
|
||||
|
||||
describe('getDateInPast', () => {
|
||||
it('returns the correct date in the past', () => {
|
||||
const date = new Date(1563235200000); // 2019-07-16T00:00:00.00Z
|
||||
const date = new Date(1563235200000); // 2019-07-16T00:00:00.000Z;
|
||||
const daysInPast = 90;
|
||||
const dateInPast = datetimeUtility.getDateInPast(date, daysInPast);
|
||||
|
||||
it('returns the correct date in the past', () => {
|
||||
const dateInPast = datetimeUtility.getDateInPast(date, daysInPast);
|
||||
expect(dateInPast).toBe('2019-04-17T00:00:00.000Z');
|
||||
});
|
||||
|
||||
it('does not modifiy the original date', () => {
|
||||
datetimeUtility.getDateInPast(date, daysInPast);
|
||||
expect(date).toStrictEqual(new Date(1563235200000));
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue