Commit aedeae85 authored by Eulyeon Ko's avatar Eulyeon Ko

Remove getters.js for roadmap

getters.js was accidentally left unremoved (it should have been removed)
in https://gitlab.com/gitlab-org/gitlab/-/merge_requests/50158/
parent d4477f11
import { newDate } from '~/lib/utils/datetime_utility';
import { PRESET_TYPES, DAYS_IN_WEEK } from '../constants';
/**
* Returns number representing index of last item of timeframe array from state
*
* @param {Object} state
*/
export const lastTimeframeIndex = (state) => state.timeframe.length - 1;
/**
* Returns first item of the timeframe array from state
*
* @param {Object} state
*/
export const timeframeStartDate = (state) => {
if (state.presetType === PRESET_TYPES.QUARTERS) {
return state.timeframe[0].range[0];
}
return state.timeframe[0];
};
/**
* Returns last item of the timeframe array from state depending on preset
* type set.
*
* @param {Object} state
* @param {Object} getters
*/
export const timeframeEndDate = (state, getters) => {
if (state.presetType === PRESET_TYPES.QUARTERS) {
return state.timeframe[getters.lastTimeframeIndex].range[2];
} else if (state.presetType === PRESET_TYPES.MONTHS) {
return state.timeframe[getters.lastTimeframeIndex];
}
const endDate = newDate(state.timeframe[getters.lastTimeframeIndex]);
endDate.setDate(endDate.getDate() + DAYS_IN_WEEK);
return endDate;
};
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