MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / formatDate

Function formatDate

scripts/get-changelog.ts:46–72  ·  view source on GitHub ↗
(date: Date, format: string)

Source from the content-addressed store, hash-verified

44}
45
46function formatDate(date: Date, format: string): string {
47 const year = date.getFullYear()
48 const month = String(date.getMonth() + 1).padStart(2, '0')
49 const day = String(date.getDate()).padStart(2, '0')
50
51 if (format === 'yyyy-MM-dd') {
52 return `${year}-${month}-${day}`
53 }
54 if (format === 'MMMM d') {
55 const monthNames = [
56 'January',
57 'February',
58 'March',
59 'April',
60 'May',
61 'June',
62 'July',
63 'August',
64 'September',
65 'October',
66 'November',
67 'December',
68 ]
69 return `${monthNames[date.getMonth()]} ${date.getDate()}`
70 }
71 return date.toISOString()
72}
73
74function getWeekNumber(date: Date): number {
75 const d = new Date(date)

Callers 2

generateChangelogFunction · 0.85
generateAllChangelogsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected