Feat/seconds (#38)

* change directory structure

move test file to __tests__ at the module directory

* test function

Add more tests to ensure the function remains safe

* fix coverage filter

* change directory structure

move to utilities folder

* refract formatDisplay with tst

* test millis

* test millis to seconds

* refract millis functions

* refractor timeStringToMillis

* create utility consts

* style component

* fixed bug with hidezero parameter

* fix issue with cancelling input edit

* style tweak
This commit is contained in:
Carlos Valente
2021-11-13 22:39:57 +01:00
committed by GitHub
parent 8520d08927
commit 26cb8a5bfc
17 changed files with 397 additions and 93 deletions
@@ -1,13 +1,14 @@
import { memo } from 'react';
import { formatDisplay } from 'common/dateConfig';
import { formatDisplay } from 'common/utils/dateConfig';
import styles from './Countdown.module.css';
const Countdown = ({ time, small, negative, hideZeroHours }) => {
let display = '-- : -- : --';
// prepare display string
if (time != null && !isNaN(time))
display = formatDisplay(Math.abs(time), hideZeroHours);
const display =
time != null && !isNaN(time)
? formatDisplay(time, hideZeroHours)
: '-- : -- : --';
const colour = negative ? '#ff7597' : '#fffffa';
return (
@@ -1,6 +1,6 @@
import EditableTimer from 'common/input/EditableTimer';
import { showWarningToast } from 'common/helpers/toastManager';
import { stringFromMillis } from 'common/dateConfig';
import { stringFromMillis } from 'common/utils/dateConfig';
const label = {
fontSize: '0.75em',
@@ -1,4 +1,4 @@
import { stringFromMillis } from 'common/dateConfig';
import { stringFromMillis } from 'common/utils/dateConfig';
import style from './Paginator.module.css';
export default function TodayItem(props) {
const { selected, timeStart, timeEnd, title, backstageEvent } = props;