1
0
mirror of https://github.com/morris/vanilla-todo.git synced 2025-08-22 21:52:54 +02:00

add some jsdoc for element autocomplete

This commit is contained in:
Morris Brodersen
2023-11-23 20:10:10 +01:00
parent 51c43ef35c
commit 89f6a0f390
17 changed files with 81 additions and 0 deletions

View File

@@ -7,6 +7,10 @@ export function uuid() {
});
}
/**
* @param {Date} date
* @returns {string}
*/
export function formatDateId(date) {
const y = date.getFullYear();
const m = date.getMonth() + 1;
@@ -18,6 +22,10 @@ export function formatDateId(date) {
return `${ys}-${ms}-${ds}`;
}
/**
* @param {Date} date
* @returns {string}
*/
export function formatDate(date) {
const m = formatMonth(date);
const d = formatDayOfMonth(date);
@@ -26,6 +34,10 @@ export function formatDate(date) {
return `${m} ${d} ${y}`;
}
/**
* @param {Date} date
* @returns {string}
*/
export function formatDayOfMonth(date) {
const d = date.getDate();
const t = d % 10;
@@ -51,6 +63,10 @@ export const DAY_NAMES = [
'Saturday',
];
/**
* @param {Date} date
* @returns {string}
*/
export function formatDayOfWeek(date) {
return DAY_NAMES[date.getDay()];
}
@@ -70,6 +86,10 @@ export const MONTH_NAMES = [
'December',
];
/**
* @param {Date} date
* @returns {string}
*/
export function formatMonth(date) {
return MONTH_NAMES[date.getMonth()];
}