V4.0.9版本更新合伙人H5端调整
This commit is contained in:
@@ -3,12 +3,16 @@ import {
|
||||
addShanghaiDays,
|
||||
isWineryIssueDay,
|
||||
listWineryIssueDays,
|
||||
nextPartnerBillIssueAt,
|
||||
previousShanghaiMonth,
|
||||
previousShanghaiWeek,
|
||||
shanghaiBillPeriodYmds,
|
||||
shanghaiLaggedIssueWindow,
|
||||
shanghaiMonthLastInstant,
|
||||
shanghaiMonthRange,
|
||||
shanghaiPeriodYmds,
|
||||
shanghaiT1DayWindow,
|
||||
shanghaiWeekRange,
|
||||
shanghaiWineryPeriodWindow,
|
||||
shanghaiYmd,
|
||||
startOfShanghaiDay,
|
||||
@@ -145,3 +149,54 @@ describe('previousShanghaiMonth', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('shanghaiWeekRange', () => {
|
||||
it('周三落入当周周一至下周一', () => {
|
||||
const { start, endExclusive } = shanghaiWeekRange(new Date('2026-09-02T04:00:00+08:00'));
|
||||
expect(shanghaiYmd(start)).toBe('2026-08-31');
|
||||
expect(shanghaiYmd(endExclusive)).toBe('2026-09-07');
|
||||
});
|
||||
|
||||
it('周日仍属当周(周一为起点)', () => {
|
||||
const { start } = shanghaiWeekRange(new Date('2026-09-06T23:00:00+08:00'));
|
||||
expect(shanghaiYmd(start)).toBe('2026-08-31');
|
||||
});
|
||||
});
|
||||
|
||||
describe('previousShanghaiWeek', () => {
|
||||
it('周一 08:00 取上一完整周', () => {
|
||||
const prev = previousShanghaiWeek(new Date('2026-09-07T08:00:00+08:00'));
|
||||
expect(shanghaiYmd(prev.start)).toBe('2026-08-31');
|
||||
expect(shanghaiYmd(prev.endExclusive)).toBe('2026-09-07');
|
||||
});
|
||||
});
|
||||
|
||||
describe('nextPartnerBillIssueAt', () => {
|
||||
it('周一 07:59 出账日为当日 08:00', () => {
|
||||
const at = nextPartnerBillIssueAt(new Date('2026-09-07T07:59:00+08:00'));
|
||||
expect(at.toISOString()).toBe(new Date('2026-09-07T08:00:00+08:00').toISOString());
|
||||
});
|
||||
|
||||
it('周一 08:00 起指向下周一', () => {
|
||||
const at = nextPartnerBillIssueAt(new Date('2026-09-07T08:00:00+08:00'));
|
||||
expect(at.toISOString()).toBe(new Date('2026-09-14T08:00:00+08:00').toISOString());
|
||||
});
|
||||
});
|
||||
|
||||
describe('shanghaiBillPeriodYmds', () => {
|
||||
it('周账展示周一至周日', () => {
|
||||
const start = new Date('2026-08-31T00:00:00+08:00');
|
||||
const end = new Date('2026-09-06T23:59:59.999+08:00');
|
||||
expect(shanghaiBillPeriodYmds(start, end)).toEqual({
|
||||
periodStart: '2026-08-31',
|
||||
periodEnd: '2026-09-06',
|
||||
});
|
||||
});
|
||||
|
||||
it('无止日或跨度大时回退自然月', () => {
|
||||
expect(shanghaiBillPeriodYmds(new Date('2026-08-01T00:00:00+08:00'))).toEqual({
|
||||
periodStart: '2026-08-01',
|
||||
periodEnd: '2026-08-31',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user