UNPKG

@zohodesk/hooks

Version:

Unified Component Library - Hooks

24 lines (20 loc) 523 B
import { timeEncode } from "../utils/timeConverter"; import { CHANGETIME } from "./constants"; function timeReducer() { let state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : { time: '' }; let action = arguments.length > 1 ? arguments[1] : undefined; switch (action.type) { case CHANGETIME: let newTime = { time: timeEncode(action.data) }; return newTime; default: return { time: action.data }; } } export default timeReducer;