Permalink
Browse files

Handle nulls when calculating hours and minutes string

  • Loading branch information...
lovett committed Feb 2, 2019
1 parent 8eb8be1 commit 77e3b13ccc05171fcf8b7bff6e3f49c923b7ab91
Showing with 20 additions and 11 deletions.
  1. +2 −2 app/Helpers/TimeHelper.php
  2. +18 −9 public/js/app.js
@@ -21,11 +21,11 @@ class TimeHelper
/**
* Display an integer as an "x hours, y minutes" English phrase.
*
* @param int $minutes The value to be displayed
* @param int|null $minutes The value to be displayed
*
* @return string
*/
public static function hoursAndMinutes(int $minutes)
public static function hoursAndMinutes(?int $minutes)
{
if ($minutes === 0) {
return '0 minutes';
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global) {/**!
* @fileOverview Kickass library to create and place poppers near their reference elements.
* @version 1.14.6
* @version 1.14.7
* @license
* Copyright (c) 2016 Federico Zivolo and contributors
*
if (getStyleComputedProperty(element, 'position') === 'fixed') {
return true;
}
return isFixed(getParentNode(element));
var parentNode = getParentNode(element);
if (!parentNode) {
return false;
}
return isFixed(parentNode);
}

/**
var _data$offsets = data.offsets,
popper = _data$offsets.popper,
reference = _data$offsets.reference;
var round = Math.round,
floor = Math.floor;


var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
var isVariation = data.placement.indexOf('-') !== -1;
var sameWidthOddness = reference.width % 2 === popper.width % 2;
var bothOddWidth = reference.width % 2 === 1 && popper.width % 2 === 1;
var noRound = function noRound(v) {
return v;
};

var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthOddness ? Math.round : Math.floor;
var verticalToInteger = !shouldRound ? noRound : Math.round;
var referenceWidth = round(reference.width);
var popperWidth = round(popper.width);

var isVertical = ['left', 'right'].indexOf(data.placement) !== -1;
var isVariation = data.placement.indexOf('-') !== -1;
var sameWidthParity = referenceWidth % 2 === popperWidth % 2;
var bothOddWidth = referenceWidth % 2 === 1 && popperWidth % 2 === 1;

var horizontalToInteger = !shouldRound ? noRound : isVertical || isVariation || sameWidthParity ? round : floor;
var verticalToInteger = !shouldRound ? noRound : round;

return {
left: horizontalToInteger(bothOddWidth && !isVariation && shouldRound ? popper.left - 1 : popper.left),

0 comments on commit 77e3b13

Please sign in to comment.