Skip to content

Commit

Permalink
Created a const
Browse files Browse the repository at this point in the history
  • Loading branch information
Tolga Akin committed Oct 19, 2018
1 parent 7575013 commit aa3080a
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions assets/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ const TIME_FORMAT = getConfig('time_format');
const DATE_FORMAT = getConfig('date_format', 'DD-MM-YYYY');
const COVERAGE_DATE_FORMAT = getConfig('coverage_date_format');
const DATETIME_FORMAT = `${TIME_FORMAT} ${DATE_FORMAT}`;
const DAY_IN_MINUTES = 24 * 60 - 1;


/**
* Create redux store with default middleware
Expand Down Expand Up @@ -196,16 +198,15 @@ export function formatAgendaDate(agendaDate, group) {
const start = parseDate(agendaDate.start);
const end = parseDate(agendaDate.end);
const duration = end.diff(start, 'minutes');
const dayInMinutes = 1439; // 24 * 60 - 1
const dateGroup = group ? moment(group, DATE_FORMAT) : null;

if (duration > dayInMinutes) {
if (duration > DAY_IN_MINUTES) {
// Multi day event
return [`(${formatTime(start)} ${formatDate(start)} - ${formatTime(end)} ${formatDate(end)})`,
dateGroup ? formatDate(dateGroup) : ''];
}

if (duration == dayInMinutes) {
if (duration == DAY_IN_MINUTES) {
// All day event
return [gettext('ALL DAY'), formatDate(start)];
}
Expand Down

0 comments on commit aa3080a

Please sign in to comment.