- Клиентская часть Vue 3 + Vite - Серверная часть Node.js + WebSocket - Система авторизации и смен - Управление игровыми портами - Поддержка тем (светлая/темная) - Адаптивный дизайн 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
38 lines
1.1 KiB
JavaScript
38 lines
1.1 KiB
JavaScript
// Модуль для работы с датами
|
||
|
||
let GMT_offset = 0;
|
||
|
||
module.exports = {
|
||
setGMT: function(offset) {
|
||
GMT_offset = offset;
|
||
console.log('Установлен часовой пояс GMT+' + offset);
|
||
},
|
||
|
||
getGMT: function() {
|
||
return GMT_offset;
|
||
},
|
||
|
||
now: function() {
|
||
const now = new Date();
|
||
return new Date(now.getTime() + GMT_offset * 60 * 60 * 1000);
|
||
},
|
||
|
||
format: function(date, format = 'YYYY-MM-DD HH:mm:ss') {
|
||
const d = date || this.now();
|
||
|
||
const year = d.getFullYear();
|
||
const month = String(d.getMonth() + 1).padStart(2, '0');
|
||
const day = String(d.getDate()).padStart(2, '0');
|
||
const hours = String(d.getHours()).padStart(2, '0');
|
||
const minutes = String(d.getMinutes()).padStart(2, '0');
|
||
const seconds = String(d.getSeconds()).padStart(2, '0');
|
||
|
||
return format
|
||
.replace('YYYY', year)
|
||
.replace('MM', month)
|
||
.replace('DD', day)
|
||
.replace('HH', hours)
|
||
.replace('mm', minutes)
|
||
.replace('ss', seconds);
|
||
}
|
||
};
|