mirror of
https://github.com/actions/stale.git
synced 2025-12-23 08:58:17 +00:00
* docs(readme): add a small precision about the operations-per-run closes #230 * chore(lint): ignore the lib folder for prettier * chore(date): add a function to check if a date is valid * chore(date): add a function to get a humanized date * chore(date): add a function to check if the date is more recent than * feat(date): add a start date to ignore old issues and PRs closes #174 * docs(readme): change the date to match the description * chore(date): add a better type for the date * docs(date): add missing JSDoc about the return type * chore(rebase): fix issues due to rebase * docs(readme): fix table formatting issues
18 lines
395 B
TypeScript
18 lines
395 B
TypeScript
import {HumanizedDate} from '../../types/humanized-date';
|
|
|
|
export function getHumanizedDate(date: Readonly<Date>): HumanizedDate {
|
|
const year: number = date.getFullYear();
|
|
let month = `${date.getMonth() + 1}`;
|
|
let day = `${date.getDate()}`;
|
|
|
|
if (month.length < 2) {
|
|
month = `0${month}`;
|
|
}
|
|
|
|
if (day.length < 2) {
|
|
day = `0${day}`;
|
|
}
|
|
|
|
return [day, month, year].join('-');
|
|
}
|