mirror of
https://github.com/lingble/chatwoot.git
synced 2025-11-02 03:57:52 +00:00
fix: Set date hours to 9 in snooze time (#7426)
This commit is contained in:
@@ -8,6 +8,8 @@ import {
|
||||
isMonday,
|
||||
isToday,
|
||||
setHours,
|
||||
setMinutes,
|
||||
setSeconds,
|
||||
} from 'date-fns';
|
||||
import wootConstants from 'dashboard/constants/globals';
|
||||
|
||||
@@ -36,7 +38,7 @@ export const findNextDay = currentDate => {
|
||||
};
|
||||
|
||||
export const setHoursToNine = date => {
|
||||
return setHours(date, 9, 0, 0);
|
||||
return setSeconds(setMinutes(setHours(date, 9), 0), 0);
|
||||
};
|
||||
|
||||
export const findSnoozeTime = (snoozeType, currentDate = new Date()) => {
|
||||
|
||||
@@ -40,6 +40,11 @@ describe('#Snooze Helpers', () => {
|
||||
nextDay.setHours(9, 0, 0, 0);
|
||||
expect(setHoursToNine(nextDay)).toEqual(nextDay);
|
||||
});
|
||||
it('should return date with 9.00AM time if date with 10am is passes', () => {
|
||||
const nextDay = new Date('06/17/2023 10:00:00');
|
||||
nextDay.setHours(9, 0, 0, 0);
|
||||
expect(setHoursToNine(nextDay)).toEqual(nextDay);
|
||||
});
|
||||
});
|
||||
|
||||
describe('findSnoozeTime', () => {
|
||||
|
||||
Reference in New Issue
Block a user