Frage

Using GeddyJS I have created a web app.

I have table with a datetime that I want to be relative ("5 minutes since..."). However the function in the GeddyJS docs isn't available when I use it in my page. it says

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)

How should I make the call?

War es hilfreich?

Lösung

Looks like you should be using geddy.date.relativeTime not geddy.relativeTime.

Andere Tipps

Did you assign it to res.locals.geddy = geddy; ?

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top