Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeado.js #28

Open
changagp opened this issue Jan 11, 2022 · 1 comment
Open

timeado.js #28

changagp opened this issue Jan 11, 2022 · 1 comment

Comments

@changagp
Copy link

hola buenas:
he estado viendo el curso y me esta dando este error, no entiendo por que si la notacion fue actualizada

[email protected] dev
nodemon src/index.js

[nodemon] 2.0.15
[nodemon] to restart at any time, enter rs
[nodemon] watching path(s): .
[nodemon] watching extensions: js,mjs,json
[nodemon] starting node src/index.js
C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\lib\handlebars.js:2
const timeagoInstance = timeago();
^

TypeError: timeago is not a function
at Object. (C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\lib\handlebars.js:2:25)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:816:12)
at Module.require (node:internal/modules/cjs/loader:999:19)
at require (node:internal/modules/cjs/helpers:93:18)
at Object. (C:\Users\Berta\Desktop\nodejs-mysql-links-version-2018\src\index.js:26:12)
at Module._compile (node:internal/modules/cjs/loader:1095:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1124:10)
[nodemon] app crashed - waiting for file changes before starting...

@sr1994
Copy link

sr1994 commented Feb 1, 2022

para que te funcione debes eliminar la linea const timeagoInstance = timeago(); y donde llamas a la función timeagoInstance lo reemplazas con timeago con eso te debiera funcionar a mi me funciono . te quedaria algo asi:

const timeago = require('timeago.js');

const helpers = {};

helpers.timeago = (savedTimestamp) => {
return timeago.format(savedTimestamp);
};

module.exports = helpers;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants