UNPKG

shashikumar-package

Version:
22 lines (19 loc) 591 B
// input: Date // output: string of format YYYY-MM-DD export const formatDate = (date: Date): string => { const year = date.getFullYear(); const month = date.getMonth() + 1; const day = date.getDate(); return `${year}-${month}-${day}`; }; export const greetName = (name: string): string => { return `hello ${name}`; } // input: Date // output: string of format HH:MM:SS export const getTimeFromDate = (date: Date): string => { const hours = date.getHours(); const minutes = date.getMinutes(); const seconds = date.getSeconds(); return `${hours}:${minutes}:${seconds}`; }