You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Due for payment 2026-08-27] Report - Monthly submission date in Next Step differs by one day from date set in Workflows #97875
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Version Number: 9.4.50-0 Reproducible in staging?: Yes Reproducible in production?: Yes If this was caught during regression testing, add the test name, ID and link from BrowserStack:https://test-management.browserstack.com/projects/2219752/folder/13176703/test-cases/41236816 Email or phone of affected tester (no customers):fischer9966+080426cadm@gmail.com Issue reported by: Applause Internal Team Bug source: Exploratory - Significant User Experience Deterioration Device used: MacOS 26.5.2 / Chrome, Safari. iPhone 17 Pro / 26.5.2. Google Pixel 5 / Android 14 App Component: Workspace Settings
Action Performed:
Go to staging.new.expensify.com or open Expensify App
Login with new gmail account
Create new workspace
Go to Workspace settings > Workflows
Enable Submissions
Set Submission frequency to Monthly
Select any day of the month (1 - 31)
Go to Workspace and create expense (no submit)
Check submission date in Next Step banner
Expected Result:
Monthly submission date in Next Step banner should match the date specified in the workspace settings.
Actual Result:
Monthly submission date in Next Step differs by one day from date set in Workflows
⚠️ Automated analysis (high confidence). The Next Step banner is generated client-side in App, so this is fixable here.
TL;DR: The monthly submit date is built correctly in local time but then re-parsed from a date-only string with new Date(...), which JS interprets as UTC midnight. When formatted back in local time, users in any timezone behind UTC (all of the Americas — the reporter is on Windows Chrome) see the day shifted back by one.
letetaDateTime=setDate(newDate(),policy?.autoReportingOffset);// e.g. the 15th, local
...
nextStep.eta={dateTime: format(etaDateTime,'yyyy-MM-dd')};// "2026-08-15"
Then at render time in NextStepUtils.ts:81-84 the date-only string is re-parsed with native new Date(...):
eta=format(newDate(nextStep.eta.dateTime),formatString);// 'do' → ordinal day
Per the ECMAScript spec, new Date('2026-08-15') (a date-only ISO string) is parsed as UTC midnight. date-fnsformat() then renders in the browser's local time. For a negative UTC offset (e.g. America/New_York, UTC-5), UTC midnight of the 15th is 19:00 on the 14th local — so the 'do' ordinal prints "14th" instead of "15th". This matches the reported one-day-earlier symptom exactly, and explains why it only reproduces in UTC-negative timezones.
The saved setting is not at fault: the day-of-month is stored verbatim (1-based) in policy.autoReportingOffset with no conversion, so this is purely a display bug.
What changes do you think we should make in order to solve the problem?
Parse the date-only string as a local date at NextStepUtils.ts:83 instead of letting native new Date() treat it as UTC — e.g. use date-fnsparseISO(nextStep.eta.dateTime) (which parses date-only strings as local midnight), or a shared DateUtils local-date parser. Verify no other eta.dateTime producer relies on the current UTC behavior before changing this shared render path.
Investigation details & alternatives considered
Client-side vs backend: The whole Next Step message (including this date) is built optimistically in App via useOptimisticNextStep → getReportNextStep → buildOptimisticNextStep. The backend does not supply this string, so App can fix it.
Not a 0-vs-1 index bug:autoReportingOffset is a 1-indexed day-of-month and setDate's dayOfMonth arg is also 1-indexed, so the build step preserves the correct day. The shift is introduced only at the UTC re-parse.
Format string: the monthly automatic-submit path uses CONST.DATE.ORDINAL_DAY_OF_MONTH ('do'), so the one-day UTC shift is directly visible as a wrong day number.
Alternative considered: serializing/rendering with a full timestamp instead of a date-only string — heavier and unnecessary; parsing as local is the minimal fix.
Storage (clean): WorkspaceAutoReportingMonthlyOffsetPage.tsx → setWorkspaceAutoReportingMonthlyOffset in Policy.ts (no date math)
Next Steps for Contributor+ team: To accept:@MelvinBot implement [this](https://github.com/Expensify/App/issues/97875) to create a draft PR. To refine:@MelvinBot <your feedback> To reject: Explain why you are rejecting Melvin's proposal.
Please mark it as "Ready for review" when it is ready for review.
What it does: Parses the monthly automatic-submit ETA (a date-only yyyy-MM-dd string) with date-fnsparseISO in the Next Step render path instead of native new Date(...). Native new Date('2026-08-15') parses as UTC midnight, which shifts the day back by one when formatted in a UTC-negative timezone; parseISO parses it as local midnight so the rendered day matches the day set in Workspace Settings → Workflows.
Changes:
src/libs/NextStepUtils.ts — new Date(nextStep.eta.dateTime) → parseISO(nextStep.eta.dateTime) in buildNextStepMessage.
tests/unit/NextStepUtilsTest.ts — added a regression test asserting the monthly automatic-submit ETA renders the day-of-month it encodes.
Local checks run: NextStepUtilsTest (37 passed), oxfmt, ESLint (0 errors), and typecheck-tsgo — all green. The human co-author still needs to fill in the Tests/QA sections and complete the author checklist before marking the PR ready for review.
[Contributor] The offending PR and associated issue have been commented on, pointing out the bug it caused and why, so the author and reviewers can learn from the mistake.
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Open App
Login with new gmail account
Create new workspace
Go to Workspace settings > Workflows
Enable Submissions
Set Submission frequency to Monthly
Select any day of the month (1 - 31)
Go to Workspace and create expense (no submit)
Check submission date in Next Step banner
Verify that monthly submission date in Next Step banner should match the date specified in the workspace settings.
Awaiting PaymentAuto-added when associated PR is deployed to productionBugSomething is broken. Auto assigns a BugZero manager.DailyKSv2ExternalAdded to denote the issue can be worked on by a contributor
Activity
applause-bot commentedon Aug 5, 2026
While Applause doesn't embed attachments for this bug, here are the links for quick view:
https://platform.applause.com/services/links/v1/external/84e1c32e43f5ef41cef4673df9b9e277da704251bcf227f97c719a117160ddce
MelvinBot commentedon Aug 5, 2026
Proposal
TL;DR: The monthly submit date is built correctly in local time but then re-parsed from a date-only string with
new Date(...), which JS interprets as UTC midnight. When formatted back in local time, users in any timezone behind UTC (all of the Americas — the reporter is on Windows Chrome) see the day shifted back by one.What is the root cause of that problem?
In
NextStepUtils.ts:196-208, the monthly ETA is built and serialized in local time:Then at render time in
NextStepUtils.ts:81-84the date-only string is re-parsed with nativenew Date(...):Per the ECMAScript spec,
new Date('2026-08-15')(a date-only ISO string) is parsed as UTC midnight.date-fnsformat()then renders in the browser's local time. For a negative UTC offset (e.g.America/New_York, UTC-5), UTC midnight of the 15th is 19:00 on the 14th local — so the'do'ordinal prints "14th" instead of "15th". This matches the reported one-day-earlier symptom exactly, and explains why it only reproduces in UTC-negative timezones.The saved setting is not at fault: the day-of-month is stored verbatim (1-based) in
policy.autoReportingOffsetwith no conversion, so this is purely a display bug.What changes do you think we should make in order to solve the problem?
Parse the date-only string as a local date at
NextStepUtils.ts:83instead of letting nativenew Date()treat it as UTC — e.g. usedate-fnsparseISO(nextStep.eta.dateTime)(which parses date-only strings as local midnight), or a sharedDateUtilslocal-date parser. Verify no othereta.dateTimeproducer relies on the current UTC behavior before changing this shared render path.Investigation details & alternatives considered
useOptimisticNextStep→getReportNextStep→buildOptimisticNextStep. The backend does not supply this string, so App can fix it.autoReportingOffsetis a 1-indexed day-of-month andsetDate'sdayOfMontharg is also 1-indexed, so the build step preserves the correct day. The shift is introduced only at the UTC re-parse.CONST.DATE.ORDINAL_DAY_OF_MONTH('do'), so the one-day UTC shift is directly visible as a wrong day number.Key references:
NextStepUtils.ts:196-208NextStepUtils.ts:81-84WorkspaceAutoReportingMonthlyOffsetPage.tsx→setWorkspaceAutoReportingMonthlyOffsetinPolicy.ts(no date math)Next Steps for Contributor+ team:
To accept:
@MelvinBot implement [this](https://github.com/Expensify/App/issues/97875)to create a draft PR.To refine:
@MelvinBot <your feedback>To reject: Explain why you are rejecting Melvin's proposal.
melvin-bot commentedon Aug 5, 2026
Triggered auto assignment to Contributor-plus team member for initial proposal review - @ZhenjaHorbach (
External)melvin-bot commentedon Aug 5, 2026
Job added to Upwork: https://www.upwork.com/jobs/~022084998358328996703
ZhenjaHorbach commentedon Aug 10, 2026
@MelvinBot
Implement your proposal
MelvinBot commentedon Aug 10, 2026
🤖 Draft PR created: #98132
Please mark it as "Ready for review" when it is ready for review.
What it does: Parses the monthly automatic-submit ETA (a date-only
yyyy-MM-ddstring) withdate-fnsparseISOin the Next Step render path instead of nativenew Date(...). Nativenew Date('2026-08-15')parses as UTC midnight, which shifts the day back by one when formatted in a UTC-negative timezone;parseISOparses it as local midnight so the rendered day matches the day set in Workspace Settings → Workflows.Changes:
src/libs/NextStepUtils.ts—new Date(nextStep.eta.dateTime)→parseISO(nextStep.eta.dateTime)inbuildNextStepMessage.tests/unit/NextStepUtilsTest.ts— added a regression test asserting the monthly automatic-submit ETA renders the day-of-month it encodes.Local checks run:
NextStepUtilsTest(37 passed),oxfmt, ESLint (0 errors), andtypecheck-tsgo— all green. The human co-author still needs to fill in the Tests/QA sections and complete the author checklist before marking the PR ready for review.melvin-bot commentedon Aug 13, 2026
@ZhenjaHorbach Whoops! This issue is 2 days overdue. Let's get this updated quick!
ZhenjaHorbach commentedon Aug 14, 2026
Not overdue
the PR is being reviewed
8 remaining items
ZhenjaHorbach commentedon Aug 20, 2026
Not overdue
melvin-bot commentedon Aug 25, 2026
@ZhenjaHorbach Eep! 4 days overdue now. Issues have feelings too...
melvin-bot commentedon Aug 26, 2026
Triggered auto assignment to @mallenexpensify (
Awaiting Payment)melvin-bot commentedon Aug 26, 2026
Payment Summary
Resolving PRs:
Fix monthly Next Step submit date shifting one day back in UTC-negative timezones #98132
Reviewer: @ZhenjaHorbach owed $250 via NewDot
BugZero Checklist (@mallenexpensify)
ZhenjaHorbach commentedon Aug 27, 2026
Contributor+ Checklist:
https://github.com/Expensify/App/pull/82549/changes#r3871506841
[Contributor] If the regression was CRITICAL (e.g. interrupts a core flow) A discussion in #expensify-open-source has been started about whether any other steps should be taken (e.g. updating the PR review checklist) in order to catch this type of bug sooner.
Link to discussion: NA
[Contributor] If it was decided to create a regression test for the bug, please propose the regression test steps using the template below to ensure the same bug will not reach production again.
Regression Test Proposal
Test:
Do we agree 👍 or 👎
mallenexpensify commentedon Aug 27, 2026
Payment Summary
Contributor+: @ZhenjaHorbach due $250 via NewDot
garrettmknight commentedon Sep 2, 2026
$250 approved for @ZhenjaHorbach