Describe the bug
When I am adding two or more pages to Collections in Eleventy, there is a "Cannot read property 'getTime' of undefined" because there no date field automatically added through the collection which can be used by it inside Sortable.js and hence causing an error.
To Reproduce
let data = [
{
name: 'abc'
},
{
name:'xyz'
}
]
Expected behavior
The pages should be built and all the pages can be added to the collection.
Screenshots

**"Problem writing Eleventy templates: (more in DEBUG output)
Cannot read property 'getTime' of undefined
TypeError was thrown:
TypeError: Cannot read property 'getTime' of undefined"**
Error file : node_modules\@11ty\eleventy\src\Util\Sortable.js:98:17)
Additional context
If you use the data set below, it works because we can explicitly add a date field and hence the pages can be built and collections can be sorted.
let data = [
{
name: 'abc',
date:'2020-10-07T19:22:49.335Z'
},
{
name:'xyz',
date:'2020-10-07T19:22:49.335Z'
}
]
I recently got this error when I was accidentally overriding the page variable provided by eleventy on the pagination:
pagination:
data: productPages
size: 1
alias: page
...
---
Using another name for the pagination alias solves the issue for me.
Most helpful comment
I recently got this error when I was accidentally overriding the
pagevariable provided by eleventy on the pagination:Using another name for the pagination alias solves the issue for me.