verdnatura-chat/app/containers/Passcode/utils.ts

15 lines
454 B
TypeScript

import AsyncStorage from '@react-native-community/async-storage';
import moment from 'moment';
import { LOCKED_OUT_TIMER_KEY, TIME_TO_LOCK } from '../../lib/constants';
export const getLockedUntil = async () => {
const t = await AsyncStorage.getItem(LOCKED_OUT_TIMER_KEY);
if (t) {
return moment(t).add(TIME_TO_LOCK).toDate();
}
return null;
};
export const getDiff = (t: string | number | Date) => new Date(t).getTime() - new Date().getTime();