Skip to content

Conversation

@hmacr
Copy link
Contributor

@hmacr hmacr commented Nov 3, 2025

Task: https://linear.app/appwrite/issue/SER-279/error-creating-expired-file-token

Summary by CodeRabbit

  • Bug Fixes
    • Fixed expiration date input to prevent selecting past dates by enforcing a minimum date constraint.
    • Improved date value normalization and handling for better data consistency.

@appwrite
Copy link

appwrite bot commented Nov 3, 2025

Console

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Failed Failed View Logs Preview URL QR Code

Tip

Appwrite has a Discord community with over 16 000 members.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 3, 2025

Walkthrough

The change modifies the expirationInput.svelte component to replace the InputDateTime component with InputDate. The update includes adding a tomorrow-based minimum date constraint (minDate) and normalizing the input value to ISO date format using the toLocaleDateISO helper function. The minDate is calculated and exposed to the template as a min attribute on the date input element. A new helper import toLocaleDateISO was added to support date normalization on value changes.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

The change is contained to a single component file with straightforward refactoring from datetime to date input. The logic additions—minimum date calculation and value normalization—are simple and follow a consistent pattern. No complex branching or multi-file coordination is required.

Pre-merge checks and finishing touches

✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The pull request title 'fix: Restrict past dates for file token expiry' directly aligns with the changes made to the expirationInput component. The modifications implement a tomorrow-based minimum date calculation and apply this constraint to the date input, which prevents users from selecting past dates when setting token expiration. This is a clear and specific summary of the primary change in the changeset.
✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ser-279

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (1)
src/lib/components/expirationInput.svelte (1)

77-79: Consider making minDate reactive or use const.

The minDate is calculated once at component initialization. If the component remains mounted past midnight, the minimum date will be stale. While this is probably acceptable for typical usage, consider either:

  • Making it reactive: $: minDate = toLocaleDateISO(new Date(Date.now() + 86400000).getTime());
  • Using const instead of let if reactivity isn't needed
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 95528de and ebc271e.

📒 Files selected for processing (1)
  • src/lib/components/expirationInput.svelte (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: e2e
🔇 Additional comments (2)
src/lib/components/expirationInput.svelte (2)

9-10: LGTM: Import changes align with date-only input.

Switching from InputDateTime to InputDate and adding toLocaleDateISO are appropriate for the PR objective of restricting past dates without time components.


156-162: LGTM: Date input properly restricts past dates.

The switch to InputDate with min={minDate} correctly implements the PR objective by preventing users from selecting dates before tomorrow.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants