Skip to content

[Payment due @FitseTLT] Add end date picker with two-way duration sync on Schedule OOO#94314

Merged
stitesExpensify merged 24 commits into
mainfrom
stites-chronosOOOEndDate
Jul 8, 2026
Merged

[Payment due @FitseTLT] Add end date picker with two-way duration sync on Schedule OOO#94314
stitesExpensify merged 24 commits into
mainfrom
stites-chronosOOOEndDate

Conversation

@stitesExpensify

@stitesExpensify stitesExpensify commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

Explanation of Change

The Schedule OOO form currently only let you set a start date and type a duration, so you had to count the number of days you would be away. This adds an end date picker alongside the duration field and keeps the two in sync:

  • Setting or changing the duration updates the end date.
  • Picking an end date updates the duration (in days).
  • Changing the start date keeps whichever of duration or end date you last set, and recomputes the other.

The end date picker cannot be set to a date before the start date, and submitting with an end date before the start date shows an error. The command sent to chronos is unchanged (ooo {date} for {N} {unit} ...); the end date is a UI convenience that maps to the existing duration. End date math follows the backend rule that "for N units" ends at start plus the interval minus one day for full-day units.

Fixed Issues

$ https://github.com/Expensify/Expensify/issues/651493
PROPOSAL:

Tests

  1. Open the chronos chat and tap Schedule OOO in the header.
  2. Pick a start date. Type 3 in Duration with the unit set to days. Verify the end date is the start date plus 2 days.
  3. Change the duration unit to weeks. Verify the end date is the start date plus 20 days.
  4. Change the duration unit to months with duration 1. Verify the end date is one month after the start date minus one day.
  5. Change the duration unit to hours. Verify the end date matches the start date.
  6. With the unit on days, clear the duration and pick an end date 4 days after the start date. Verify the duration becomes 5 and the unit is days.
  7. Pick an end date first, then pick an earlier start date. Verify the duration is filled in from the gap between the two dates.
  8. Set a start date and duration, then change the start date. Verify the end date moves and the duration stays the same.
  9. Set a start date and end date, then change the start date. Verify the end date stays the same and the duration updates.
  10. Try to pick an end date earlier than the start date in the calendar. Verify it is not selectable.
  11. Submit and verify the OOO event is created for the expected range and the message sent to chronos reads ooo {start} for {N} days ....
  12. Verify that no errors appear in the JS console.
  13. Change the duration choice to "hours"
  14. Ensure that the end date form disappears
  15. Change the duration back to "days"
  16. Ensure the end date form re-appears

Offline tests

  1. Go offline.
  2. Run through the Tests steps. The form works without a connection because it is enabled offline.
  3. Submit while offline and verify the message is queued and sent once back online.

QA Steps

Tag @stitesExpensify
Same as Tests, but actually book some OOO and make sure it works.

  • Verify that no errors appear in the JS console

PR Author Checklist

  • I linked the correct issue in the ### Fixed Issues section above
  • I wrote clear testing steps that cover the changes made in this PR
    • I added steps for local testing in the Tests section
    • I added steps for the expected offline behavior in the Offline steps section
    • I added steps for Staging and/or Production testing in the QA steps section
    • I added steps to cover failure scenarios (i.e. verify an input displays the correct error message if the entered data is not correct)
    • I turned off my network connection and tested it while offline to ensure it matches the expected behavior (i.e. verify the default avatar icon is displayed if app is offline)
    • I tested this PR with a High Traffic account against the staging or production API to ensure there are no regressions (e.g. long loading states that impact usability).
  • I included screenshots or videos for tests on all platforms
  • I ran the tests on all platforms & verified they passed on:
    • Android: Native
    • Android: mWeb Chrome
    • iOS: Native
    • iOS: mWeb Safari
    • MacOS: Chrome / Safari
  • I verified there are no console errors (if there's a console error not related to the PR, report it or open an issue for it to be fixed)
  • I followed proper code patterns (see Reviewing the code)
    • I verified that any callback methods that were added or modified are named for what the method does and never what callback they handle (i.e. toggleReport and not onIconClick)
    • I verified that comments were added to code that is not self explanatory
    • I verified that any new or modified comments were clear, correct English, and explained "why" the code was doing something instead of only explaining "what" the code was doing.
    • I verified any copy / text shown in the product is localized by adding it to src/languages/* files and using the translation method
    • I verified all numbers, amounts, dates and phone numbers shown in the product are using the localization methods
    • I verified any copy / text that was added to the app is grammatically correct in English. It adheres to proper capitalization guidelines (note: only the first word of header/labels should be capitalized), and is either coming verbatim from figma or has been approved by marketing (in order to get marketing approval, ask the Bug Zero team member to add the Waiting for copy label to the issue)
    • I verified proper file naming conventions were followed for any new files or renamed files. All non-platform specific files are named after what they export and are not named "index.js". All platform-specific files are named for the platform the code supports as outlined in the README.
    • I verified the JSDocs style guidelines (in STYLE.md) were followed
  • If a new code pattern is added I verified it was agreed to be used by multiple Expensify engineers
  • I followed the guidelines as stated in the Review Guidelines
  • I tested other components that can be impacted by my changes (i.e. if the PR modifies a shared library or component like Avatar, I verified the components using Avatar are working as expected)
  • I verified all code is DRY (the PR doesn't include any logic written more than once, with the exception of tests)
  • I verified any variables that can be defined as constants (ie. in CONST.ts or at the top of the file that uses the constant) are defined as such
  • I verified that if a function's arguments changed that all usages have also been updated correctly
  • If any new file was added I verified that:
    • The file has a description of what it does and/or why is needed at the top of the file if the code is not self explanatory
  • If a new CSS style is added I verified that:
    • A similar style doesn't already exist
    • The style can't be created with an existing StyleUtils function (i.e. StyleUtils.getBackgroundAndBorderStyle(theme.componentBG))
  • If new assets were added or existing ones were modified, I verified that:
    • The assets are optimized and compressed (for SVG files, run npm run compress-svg)
    • The assets load correctly across all supported platforms.
  • If the PR modifies code that runs when editing or sending messages, I tested and verified there is no unexpected behavior for all supported markdown - URLs, single line code, code blocks, quotes, headings, bold, strikethrough, and italic.
  • If the PR modifies a generic component, I tested and verified that those changes do not break usages of that component in the rest of the App (i.e. if a shared library or component like Avatar is modified, I verified that Avatar is working as expected in all cases)
  • If the PR modifies a component related to any of the existing Storybook stories, I tested and verified all stories for that component are still working as expected.
  • If the PR modifies a component or page that can be accessed by a direct deeplink, I verified that the code functions as expected when the deeplink is used - from a logged in and logged out account.
  • If the PR modifies the UI (e.g. new buttons, new UI components, changing the padding/spacing/sizing, moving components, etc) or modifies the form input styles:
    • I verified that all the inputs inside a form are aligned with each other.
    • I added Design label and/or tagged @Expensify/design so the design team can review the changes.
  • If a new page is added, I verified it's using the ScrollView component to make it scrollable when more elements are added to the page.
  • I added unit tests for any new feature or bug fix in this PR to help automatically prevent regressions in this user flow.
2026-07-06_15-46-27 2026-06-24_10-35-11

@OSBotify

Copy link
Copy Markdown
Contributor

🦜 Polyglot Parrot! 🦜

Squawk! Looks like you added some shiny new English strings. Allow me to parrot them back to you in other tongues:

View the translation diff
diff --git a/src/languages/es.ts b/src/languages/es.ts
index a4cea1d3904..5c06301507b 100644
--- a/src/languages/es.ts
+++ b/src/languages/es.ts
@@ -8069,14 +8069,14 @@ ${amount} para ${merchant} - ${date}`,
         scheduleOOO: 'Programar ausencia',
         scheduleOOOTitle: 'Programar fuera de oficina',
         date: 'Fecha de inicio',
-        endDate: 'Fecha de fin',
+        endDate: 'Fecha de finalización',
         time: 'Hora (formato de 24 horas)',
         durationAmount: 'Duración',
         durationUnit: 'Unidad',
         reason: 'Motivo',
         workingPercentage: 'Porcentaje de trabajo',
         dateRequired: 'La fecha de inicio es obligatoria.',
-        endDateBeforeStart: 'La fecha de fin no puede ser anterior a la fecha de inicio.',
+        endDateBeforeStart: 'La fecha de finalización no puede ser anterior a la fecha de inicio.',
         invalidTimeFormat: 'Ingresa una hora válida (ej., 14:30).',
         enterANumber: 'Ingresa un número.',
         hour: 'horas',
diff --git a/src/languages/ja.ts b/src/languages/ja.ts
index 02f06c82c65..ac2835d12fb 100644
--- a/src/languages/ja.ts
+++ b/src/languages/ja.ts
@@ -8175,8 +8175,8 @@ ${reportName}
         durationUnit: '単位',
         reason: '理由',
         workingPercentage: '稼働率',
-        dateRequired: '開始日は必須です。',
-        endDateBeforeStart: '終了日を開始日より前にすることはできません。',
+        dateRequired: '開始日が必要です。',
+        endDateBeforeStart: '終了日は開始日より前にはできません。',
         invalidTimeFormat: '有効な24時間表記の時刻を入力してください(例: 14:30)。',
         enterANumber: '数字を入力してください。',
         hour: '時間',
diff --git a/src/languages/nl.ts b/src/languages/nl.ts
index 9f0663ef2fc..bb4cbbbf627 100644
--- a/src/languages/nl.ts
+++ b/src/languages/nl.ts
@@ -8249,7 +8249,7 @@ er bestedingsregels toe om de kasstroom van het bedrijf te beschermen.`,
         reason: 'Reden',
         workingPercentage: 'Werkpercentage',
         dateRequired: 'Startdatum is verplicht.',
-        endDateBeforeStart: 'De einddatum kan niet vóór de startdatum liggen.',
+        endDateBeforeStart: 'Einddatum kan niet vóór de startdatum liggen.',
         invalidTimeFormat: 'Voer een geldige 24-uurs tijd in (bijv. 14:30).',
         enterANumber: 'Voer een getal in.',
         hour: 'uren',
diff --git a/src/languages/pl.ts b/src/languages/pl.ts
index 9340b7ad546..1ba0f1630da 100644
--- a/src/languages/pl.ts
+++ b/src/languages/pl.ts
@@ -8230,7 +8230,7 @@ Dodaj więcej zasad wydatków, żeby chronić płynność finansową firmy.`,
         stopTimer: (duration: string) => `Zatrzymaj licznik czasu (${duration})`,
         scheduleOOO: 'Zaplanuj nieobecność',
         scheduleOOOTitle: 'Zaplanuj nieobecność',
-        date: 'Data rozpoczęcia',
+        date: 'Data początkowa',
         endDate: 'Data zakończenia',
         time: 'Czas (format 24-godzinny)',
         durationAmount: 'Czas trwania',

Note

You can apply these changes to your branch by copying the patch to your clipboard, then running pbpaste | git apply 😉

View workflow run

@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ Changes either increased or maintained existing code coverage, great job!

Files with missing lines Coverage Δ
src/libs/ChronosUtils.ts 98.82% <100.00%> (+0.74%) ⬆️
src/types/form/ChronosScheduleOOOForm.ts 0.00% <ø> (ø)
src/pages/ChronosScheduleOOOPage.tsx 0.00% <0.00%> (ø)
... and 156 files with indirect coverage changes

@stitesExpensify stitesExpensify added the InternalQA This pull request required internal QA label Jun 24, 2026
@stitesExpensify stitesExpensify marked this pull request as ready for review June 24, 2026 19:10
@stitesExpensify stitesExpensify requested review from a team as code owners June 24, 2026 19:10
@melvin-bot melvin-bot Bot requested review from FitseTLT and removed request for a team June 24, 2026 19:10
@melvin-bot

melvin-bot Bot commented Jun 24, 2026

Copy link
Copy Markdown

@FitseTLT Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot requested review from flaviadefaria and removed request for a team June 24, 2026 19:10
Comment thread src/pages/ChronosScheduleOOOPage.tsx Outdated
@FitseTLT

Copy link
Copy Markdown
Contributor

Should I review @stitesExpensify ?

@stitesExpensify

Copy link
Copy Markdown
Contributor Author

Yes please @FitseTLT !

@FitseTLT

Copy link
Copy Markdown
Contributor

@stitesExpensify end date before start date error doesn't disallow the schedule submission.

Comment thread src/libs/ChronosUtils.ts
return format(addDays(addMonths(start, whole), -1), CONST.DATE.FNS_FORMAT_STRING);
case CONST.CHRONOS.OOO_DURATION_UNITS.HOUR:
default:
return startDate;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@stitesExpensify this is more confusing. What if they input > 1 amount as long as the unit says hours users would input 4 for 4 hours What exactly is the expected behavior @tgolen

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can see how that would be confusing. I think we should hide the the end date if the user chooses hours and just avoid that case completely

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated again!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know how the BE handles it but the message directly interprets it as 9 hours if you input 9 not the fractional understanding. but we can ofcourse hide end date and let the BE handle it in its way.
image

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I'm not too picky here. I think ideally, we would have two date+time pickers. Since we don't have that component, I think it makes it a little awkward for edge cases like this.

@FitseTLT

FitseTLT commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

@stitesExpensify end date before start date error doesn't disallow the schedule submission.

@stitesExpensify U haven't still fixed this 😄

@stitesExpensify

Copy link
Copy Markdown
Contributor Author

@FitseTLT Fixed. Moving the start date past a chosen end date now clears the end date instead of leaving an invalid range, so end-before-start can't reach submission. The validation error stays as a backstop.

@FitseTLT

FitseTLT commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

It will trigger the error too is that ok.

2026-07-07.19-21-15.mp4

@FitseTLT

FitseTLT commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Also We don't calculate start date from end date and amount but I think that's ok because start date is required.

@stitesExpensify

Copy link
Copy Markdown
Contributor Author

It will trigger the error too is that ok.

That's fine IMO.

Also We don't calculate start date from end date and amount but I think that's ok because start date is required.

Agreed!

@melvin-bot melvin-bot Bot requested a review from deetergp July 7, 2026 19:33
@melvin-bot

melvin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

@deetergp Please copy/paste the Reviewer Checklist from here into a new comment on this PR and complete it. If you have the K2 extension, you can simply click: [this button]

@melvin-bot melvin-bot Bot changed the title Add end date picker with two-way duration sync on Schedule OOO [Payment due @FitseTLT] Add end date picker with two-way duration sync on Schedule OOO Jul 7, 2026
@melvin-bot

melvin-bot Bot commented Jul 7, 2026

Copy link
Copy Markdown

🎯 @FitseTLT, thanks for reviewing and testing this PR! 🎉

A payment issue will be created for your review once this PR is deployed to production.
E/E issue linked to the PR - https://www.github.com/Expensify/Expensify/issues/651493.

If payment is not needed (e.g., regression PR review fix etc), react with 👎 to this comment to prevent the payment issue from being created.

@deetergp deetergp requested a review from tgolen July 8, 2026 00:30
@stitesExpensify stitesExpensify merged commit 49ff830 into main Jul 8, 2026
46 checks passed
@stitesExpensify stitesExpensify deleted the stites-chronosOOOEndDate branch July 8, 2026 18:25
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

🚧 stitesExpensify has triggered a test Expensify/App build. You can view the workflow run here.

@OSBotify

OSBotify commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

✋ This PR was not deployed to staging yet because QA is ongoing. It will be automatically deployed to staging after the next production release.

@OSBotify

OSBotify commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

🚀 Deployed to staging by https://github.com/stitesExpensify in version: 9.4.32-0 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

@MelvinBot

Copy link
Copy Markdown
Contributor

🤖 Help site review: no changes required

I reviewed the changes in this PR against the help site articles in App/docs/articles and did not create a docs PR.

What this PR changes: It adds an end date picker to the Chronos Schedule OOO form and keeps it in sync with the existing Duration field (two-way sync). The command sent to Chronos is unchanged — the end date is a UI convenience that maps to the existing duration.

Why no docs update is needed: The Chronos Schedule OOO feature (booking time off by chatting with the Chronos bot) is not documented anywhere under App/docs/articles. The only "out of office" articles on the help site cover the Vacation Delegate feature (redirecting report approvals while you're away) — a separate feature this PR does not touch:

  • new-expensify/settings/Delegate-when-out-of-office.md
  • expensify-classic/copilots-and-delegates/Delegate-when-out-of-office.md

Since this is a UI convenience enhancement to a feature the help site doesn't currently document, there's no existing article to update and no gap this PR introduces that requires new documentation.

If you'd like a brand-new help article created to document the Chronos Schedule OOO flow (including the new end date picker), let me know and I can draft one.

@grgia

grgia commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

QA'd, checking off

@OSBotify

Copy link
Copy Markdown
Contributor

🚀 Deployed to production by https://github.com/grgia in version: 9.4.32-3 🚀

platform result
🕸 web 🕸 success ✅
🤖 android 🤖 success ✅
🍎 iOS 🍎 success ✅

Bundle Size Analysis (Sentry):

@melvin-bot

melvin-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown

🤖 Payment issue created: #95819

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

InternalQA This pull request required internal QA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants