26 lines
705 B
TypeScript
26 lines
705 B
TypeScript
|
export function getDateTime() {
|
||
|
const date = new Date();
|
||
|
const year = date.getFullYear();
|
||
|
const month = date.getMonth() + 1;
|
||
|
const day = date.getDate();
|
||
|
const hr = date.getHours();
|
||
|
const min = date.getMinutes();
|
||
|
const secs = date.getSeconds();
|
||
|
|
||
|
return `${year}${month}${day}${hr}${min}${secs}`;
|
||
|
}
|
||
|
|
||
|
export function capitalizeString(str: string) {
|
||
|
return str.charAt(0).toUpperCase() + str.slice(1);
|
||
|
}
|
||
|
|
||
|
export function isInputLike(
|
||
|
target: Element | EventTarget | null
|
||
|
): target is HTMLInputElement | HTMLTextAreaElement | HTMLSelectElement {
|
||
|
return (
|
||
|
target instanceof HTMLInputElement ||
|
||
|
target instanceof HTMLTextAreaElement ||
|
||
|
target instanceof HTMLSelectElement
|
||
|
);
|
||
|
}
|