You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
…t to getStars function
d127462 Update date.ts (Graeme Byrne)
d5ad4a5 add new date.ts module and argument to getStars function (grmbyrn)
Pull request description:
## Enhancements to Date Formatting and `getStars` Function
### Changes Made:
1. **Date Formatting Module:**
- Moved the `formatDate` function into a separate module located at `lib/utils/date.ts`.
- Implemented in `lib/components/molecules/BlogPostCard.svelte`, `routes/(blog-article)/+layout.svelte` and `routes/rss.xml/+server.ts`
- The motivation is to centralise the date and time formatting logic and provide a single source of truth for date formatting across all components.
- By using this helper function, we can easily update the date format in one place, affecting all components simultaneously.
- This approach facilitates testing of date formatting independently of specific components.
```typescript
// src/lib/utils/date.ts
import dateFormat from 'dateformat';
export function formatDate(date: string): string {
return dateFormat(date, 'UTC:dd/mm/yyyy');
}
export function formatTime(date: string): string {
return dateFormat(date, 'UTC:HH:MM:ss');
}
2. `getStars` Function Modification:
- Added an argument to the `getStars` function in the `ProjectCard` component (`lib/components/molecules/ProjectCard.svelte`).
- The argument (`repoName`) replaces the previous usage of a global variable.
- This change promotes better code organisation and maintainability by explicitly defining function inputs.
- The modification improves the function's reusability and makes it more self-contained.
ACKs for top commit:
josecelano:
ACK d127462
Tree-SHA512: 32883a9a97720a5375ad521b52e0e4cdf2bb79f310134d9435bf9ee9f3aab10287366cadcd3f6161dc5b6d4aa5e3a95dd7ce3c2ed1bde6de6706fd2b7fb478c0
Relates to: torrust/torrust-tracker#650
LIst sources to get tracker lists from.
The text was updated successfully, but these errors were encountered: