File tree 2 files changed +8
-3
lines changed 2 files changed +8
-3
lines changed Original file line number Diff line number Diff line change 1
- export { default as day } from "https://esm.sh/[email protected] " ;
2
1
export {
3
2
basename ,
4
3
extname ,
Original file line number Diff line number Diff line change 4
4
/// <reference lib="deno.ns" />
5
5
/// <reference lib="deno.unstable" />
6
6
7
- import { basename , day , extname } from "./deps.ts" ;
7
+ import { basename , extname } from "./deps.ts" ;
8
8
import { type Manifest , type Route , type RouteProps } from "./types.ts" ;
9
9
10
10
export class SitemapContext {
@@ -94,7 +94,7 @@ export class SitemapContext {
94
94
. map ( ( route ) => {
95
95
return `<url>
96
96
<loc>${ this . #url} ${ route . pathName } </loc>
97
- <lastmod>${ day ( route . lastmod ) . format ( "YYYY-MM-DD" ) } </lastmod>
97
+ <lastmod>${ formatYearMonthDate ( route . lastmod ?? new Date ( ) ) } </lastmod>
98
98
<changefreq>${ route . changefreq ?? "daily" } </changefreq>
99
99
<priority>${ route . priority ?? "0.8" } </priority>
100
100
</url>` ;
@@ -125,3 +125,9 @@ export class SitemapContext {
125
125
// }
126
126
// }
127
127
}
128
+
129
+ function formatYearMonthDate ( date : Date ) {
130
+ return `${ date . getFullYear ( ) } -${ ( "00" + ( date . getMonth ( ) + 1 ) ) . slice ( - 2 ) } -${
131
+ ( "00" + date . getDate ( ) ) . slice ( - 2 )
132
+ } `;
133
+ }
You can’t perform that action at this time.
0 commit comments