fix-18413

Signed-off-by: npiyush97 <npiyush35@gmail.com>
This commit is contained in:
npiyush97
2023-06-28 18:59:28 +05:30
parent cb91dac435
commit 2b4513abb7
5 changed files with 20 additions and 7 deletions
+2 -1
View File
@@ -32,7 +32,8 @@
"@backstage/catalog-model": "workspace:^",
"@backstage/integration": "workspace:^",
"@backstage/plugin-search-common": "workspace:^",
"front-matter": "^4.0.2"
"front-matter": "^4.0.2",
"luxon": "3.0.0"
},
"devDependencies": {
"@backstage/cli": "workspace:^"
+4 -1
View File
@@ -21,6 +21,7 @@ import { Entity, getEntitySourceLocation } from '@backstage/catalog-model';
import { IndexableDocument } from '@backstage/plugin-search-common';
import { ScmIntegrationRegistry } from '@backstage/integration';
import frontMatter from 'front-matter';
import { DateTime } from 'luxon';
/**
* ADR plugin annotation.
@@ -135,10 +136,12 @@ export const parseMadrWithFrontmatter = (content: string): ParsedMadr => {
const parsed = frontMatter<Record<string, unknown>>(content);
const status = parsed.attributes.status;
const date = parsed.attributes.date;
const luxdate = DateTime.fromJSDate(new Date(`${date}`));
const formattedDate = luxdate.toISODate();
return {
content: parsed.body,
status: status ? String(status) : undefined,
date: date ? String(date) : undefined,
date: date ? String(formattedDate) : undefined,
attributes: parsed.attributes,
};
};