Added missing context to interpolation subfunctions.
This commit is contained in:
parent
1be31a9066
commit
149c83f34b
|
@ -21,16 +21,16 @@ function getMostFrequent(items, { slugify }) {
|
|||
return mostFrequent;
|
||||
}
|
||||
|
||||
function getMostFrequentDate(dates, { moment }) {
|
||||
const year = getMostFrequent(dates.map((dateX) => dateX.getFullYear()));
|
||||
const month = getMostFrequent(dates.map((dateX) => dateX.getMonth()));
|
||||
const date = getMostFrequent(dates.map((dateX) => dateX.getDate()));
|
||||
function getMostFrequentDate(dates, context) {
|
||||
const year = getMostFrequent(dates.map((dateX) => dateX.getFullYear()), context);
|
||||
const month = getMostFrequent(dates.map((dateX) => dateX.getMonth()), context);
|
||||
const date = getMostFrequent(dates.map((dateX) => dateX.getDate()), context);
|
||||
|
||||
if (year === null || month === null || date === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return moment({ year, month, date }).toDate();
|
||||
return context.moment({ year, month, date }).toDate();
|
||||
}
|
||||
|
||||
function getHighest(items) {
|
||||
|
|
Loading…
Reference in New Issue