Closed codeflowee closed 7 years ago
Are you sure that your moment locale is installed? What happens when you do this in your ViewModel
moment.locale('fi');
console.log(moment(1316116057189).fromNow());
moment.locale('en');
console.log(moment(1316116057189).fromNow()); // an hour ago
What skeleton are you using, CLI
, WebPack
or ASP
?
Please provide more details about your setup, if you want help.
I am using aurelia-cli
type project:
In view-model when I import moment via import moment from 'moment';
then in constructor the response for
moment.locale('fi');
console.log(moment(1316116057189).fromNow());
moment.locale('en');
console.log(moment(1316116057189).fromNow());
is
6 years ago
6 years ago
In aurelia.json
I have following for this plugin:
{
"name": "eonasdan-bootstrap-datetimepicker",
"path": "../node_modules/eonasdan-bootstrap-datetimepicker/build",
"main": "js/bootstrap-datetimepicker.min",
"resources": [
"css/bootstrap-datetimepicker.min.css"
]
},
{
"name": "aurelia-bootstrap-datetimepicker",
"path": "../node_modules/aurelia-bootstrap-datetimepicker/dist/amd",
"main": "index",
"resources": [
"**/*.{css,html}"
]
},
"moment"
Okay, thanks for leading me on the right way:
What needed for this fix was:
{
"name": "moment",
"path": "../node_modules/moment",
"main": "min/moment-with-locales"
}
in aurelia.json
This should be added into "How to" docs.
Thanks a lot for the feedback, I added a note in the README under the Aurelia-CLI
section of the aurelia-bootstrap-datetimepicker plugin. Also made it more clear under the WebPack
version as well.
Thanks, keep up the good work! :+1:
No problem, if you like the plugin, you can also click on the :star: to make it more popular :)
In my view:
Error in console: