achat-maison-albi-fr/src/utils/utils.ts
Emil Gulamov addbb5457a Refactor code and restructure directories
In response to the changes made to the directory structure of the project, the code has been refactored to adjust image import paths across various sections. It also involves reorganizing components into appropriate folders based on their roles in the application. Along with this, a new utility file for navigation links has been introduced, and configurations for authorizing remote images have been added to Astro configuration file, suggesting an enhancement in SEO performance.
2024-02-20 07:47:23 +04:00

15 lines
No EOL
487 B
TypeScript

// Format the date to a string
function formatDate(date: Date): string {
const options: Intl.DateTimeFormatOptions = {year: 'numeric', month: 'short', day: 'numeric'};
return new Date(date).toLocaleDateString(undefined, options);
}
// Capitalize the first letter
function capitalize(str:string): string {
if ( typeof str !== 'string' || str.length === 0 ) {
return str;
}
return str.charAt(0).toUpperCase() + str.slice(1);
}
export { formatDate, capitalize };