Skip to content

Commit b49855e

Browse files
again
1 parent f9fa8f8 commit b49855e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

apps/svelte.dev/src/lib/server/content.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ export const index = await create_index(documents, assets, '../../../content', r
2323
const months = 'Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec'.split(' ');
2424

2525
function format_date(date: string) {
26+
if (!/^\d{4}-\d{2}-\d{2}$/.test(date)) {
27+
throw new Error(`Invalid blog post date for date ${date}, should be in the format YYYY-MM-DD`);
28+
}
29+
2630
const [y, m, d] = date.split('-');
2731
const month = months[+m - 1];
2832
if (month === undefined) {

0 commit comments

Comments
 (0)