helpers.js

Download
javascript 26 lines 551 B
 1/**
 2 * μœ ν‹Έλ¦¬ν‹° ν•¨μˆ˜
 3 */
 4
 5export function formatDate(date) {
 6    return new Intl.DateTimeFormat('ko-KR', {
 7        year: 'numeric',
 8        month: 'long',
 9        day: 'numeric',
10        hour: '2-digit',
11        minute: '2-digit',
12    }).format(date);
13}
14
15export function debounce(func, wait) {
16    let timeout;
17    return function executedFunction(...args) {
18        const later = () => {
19            clearTimeout(timeout);
20            func(...args);
21        };
22        clearTimeout(timeout);
23        timeout = setTimeout(later, wait);
24    };
25}