Date to string fix

This commit is contained in:
Elio Struyf
2021-10-11 17:49:45 +02:00
parent df239f2cc0
commit fae7ab8417
2 changed files with 3 additions and 3 deletions
+2 -2
View File
@@ -239,13 +239,13 @@ export class Article {
/**
* Format the date to the defined format
*/
public static formatDate(dateValue: Date) {
public static formatDate(dateValue: Date): string {
const dateFormat = Settings.get(SETTING_DATE_FORMAT) as string;
if (dateFormat && typeof dateFormat === "string") {
return format(dateValue, dateFormat);
} else {
return typeof dateValue.toISOString === 'function' ? dateValue.toISOString() : dateValue;
return typeof dateValue.toISOString === 'function' ? dateValue.toISOString() : dateValue?.toString();
}
}
+1 -1
View File
@@ -458,7 +458,7 @@ export class Dashboard {
const contentType = ArticleHelper.getContentType(article.data);
const previewField = contentType.fields.find(field => field.isPreviewImage && field.type === "image")?.name || "preview";
if (article?.data[previewField] && wsFolder) {
let fieldValue = article?.data[previewField];
if (fieldValue && Array.isArray(fieldValue)) {