1

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?

cmp
  • 1,543
  • 2
  • 11
  • 18

2 Answers2

2

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

Techwraith
  • 1,298
  • 1
  • 10
  • 12
-1

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

chovy
  • 72,281
  • 52
  • 227
  • 295