在ejs页面中未定义relativeTime()实用程序

使用GeddyJS我已经创build了一个Web应用程序。

我有一个date时间表,我想成为相对的(“5分钟以来…”)。 然而,当我在我的页面中使用它时,GeddyJS文档中的function不可用。 它说

C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:74 throw err; ^ TypeError: ejs:28 26| <td><%= people[i].location %></td> 27| <td><%= people[i].recorder %></td> >> 28| <td><%= geddy.relativeTime(new Date(people[i].time)) %></td> 29| <td><%= people[i].direction %></td> 30| <td><%= people[i].transportation %></td> 31| <td>(<%= people[i].id %>)</td> Object #<Object> has no method 'relativeTime' at Template.handleErr (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:58:15) at Object.Template.compile.rethrow (C:\Users\Chris\AppData\Roaming\npm\node_modules\geddy\lib\template\engines\ejs.js:90:41) 

我应该怎么打电话?

看起来你应该使用geddy.date.relativeTime而不是geddy.relativeTime

你把它分配给res.locals.geddy = geddy;