简体   繁体   中英

Laravel vuejs momentjs timezone

I have a problem. In app.php I have a timezone:

'timezone' => 'Europe/Moscow',

In bootstrap.js I writed:

window.moment = require('moment');

window.moment.locale('ru');

In app.js I have filter:

Vue.filter('relative', value => {
   return moment(value).locale('ru').fromNow();
});

When I use this filter and add new comment with vuejs, I get time in future. On my PC timezone is another. On my pc time is: 22:04, but on laravel +1.00 (23:04). How I can use timezone only on server and show relative time of server?

Try to import moment as below:

const moment = require('moment');
require('moment/locale/ru');

This worked for me when i used moment with italian locale

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM