Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/im/v2/component/message-list/test/ |
Upload File : |
import { DateFormatter } from 'im.v2.lib.date-formatter'; import { DateManager } from '../src/classes/collection-manager/classes/date-manager'; describe('DateManager', () => { describe('getDateTitle', () => { it('should correctly handle timezone offsets', () => { // it is 25th October in UTC+0 timezone // and 26th October in UTC+2 timezone const date = new Date('2023-10-25T23:59:59.000Z'); sinon.stub(date, 'getTimezoneOffset').returns(-120); const expectedTitle = 'some formatted date'; sinon.stub(DateFormatter, 'formatByTemplate').returns(expectedTitle); const dateManager = new DateManager(); dateManager.getDateTitle(date); assert.notEqual(dateManager.cachedDateGroups['2023-10-26'], undefined); assert.equal(dateManager.cachedDateGroups['2023-10-26'], expectedTitle); }); }); });