contentful-hugo
Advanced tools
Comparing version 1.15.1 to 1.15.2
@@ -108,2 +108,16 @@ "use strict"; | ||
var isDateField = function (input) { | ||
var requiredSymbols = ['-', ':', 'T']; | ||
if (typeof input !== 'string') { | ||
return false; | ||
} | ||
for (var _i = 0, requiredSymbols_1 = requiredSymbols; _i < requiredSymbols_1.length; _i++) { | ||
var symbol = requiredSymbols_1[_i]; | ||
if (!input.includes(symbol)) { | ||
return false; | ||
} | ||
} | ||
var year = input.split('-')[0]; | ||
if (isNaN(Number(year))) { | ||
return false; | ||
} | ||
if (typeof input === 'string') { | ||
@@ -209,9 +223,7 @@ var date = Date.parse(input); | ||
default: | ||
if (exports.isDateField(fieldContent)) { | ||
if (exports.isDateField(fieldContent) && fieldContent.length > 10) { | ||
// don't convert dates with no time info | ||
// i.e. 2021-01-05 | ||
if (fieldContent.length > 10) { | ||
frontMatter[fieldName] = new Date(fieldContent).toISOString(); | ||
break; | ||
} | ||
frontMatter[fieldName] = new Date(fieldContent).toISOString(); | ||
break; | ||
} | ||
@@ -218,0 +230,0 @@ frontMatter[fieldName] = fieldContent; |
{ | ||
"name": "contentful-hugo", | ||
"version": "1.15.1", | ||
"version": "1.15.2", | ||
"description": "Node module that pulls data from Contentful and turns it into markdown files for Hugo. Can be used with other Static Site Generators, but has some Hugo specific features.", | ||
@@ -5,0 +5,0 @@ "main": "./dist/main/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
183859
224
2942