14 lines
346 B
TypeScript
14 lines
346 B
TypeScript
|
|
import dayjs from 'dayjs';
|
||
|
|
|
||
|
|
export const isInTimeRange = (startTime?: string, endTime?: string) => {
|
||
|
|
const now = dayjs();
|
||
|
|
const start = dayjs(startTime);
|
||
|
|
const end = dayjs(endTime);
|
||
|
|
|
||
|
|
return now.isAfter(start) && now.isBefore(end);
|
||
|
|
};
|
||
|
|
|
||
|
|
export function showTime(time?: string, num?: number) {
|
||
|
|
return time?.substring(0, num || 5) || '';
|
||
|
|
}
|