Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

Conversation

@yinjianfei-user
Copy link

No description provided.

Michael18811380328 and others added 30 commits August 24, 2019 16:23
Choose precise time to improve
gzcqqqqqqqq1 and others added 27 commits July 8, 2025 10:54
add esc and enter logic for time type date
update version

update version
update calendar to support time input and selection
feat(ui): update the width of year/month panel and improve style cons…
fix: keyboard handler and shortcut key
Co-authored-by: zhouwenxuan <Aries@Mac.local>
@coderabbitai
Copy link

coderabbitai bot commented Jan 20, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

@gemini-code-assist
Copy link

Summary of Changes

Hello @yinjianfei-user, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily refactors the date and time handling logic by migrating from the moment.js library to the more lightweight dayjs library. It also introduces a new user interface for selecting hours and minutes directly within the calendar, accompanied by a comprehensive visual refresh of the calendar components. These changes aim to modernize the codebase, improve performance, and enhance the user experience for time selection.

Highlights

  • Dependency Migration: The project has undergone a significant migration from moment.js to dayjs for date and time manipulation, impacting numerous files across the codebase.
  • Enhanced Time Selection UI: A new right-hand panel for hour and minute selection has been introduced to the calendar, providing a more granular time input experience. This includes new TimeInput and CalendarRightPanel components.
  • Styling Refresh: The calendar's visual appearance has been updated with new color schemes (shifting from blue to orange/yellowish tones) and layout adjustments across various components like the main calendar, month, year, and decade panels.
  • New Props for Time Control: New props showHourAndMinute and onClickRightPanelTime have been added to the Calendar component, allowing control over the visibility and interaction of the new time selection panel.
  • Project Metadata Update: The package.json has been updated to reflect a new package name (@seafile/seafile-calendar), version, author, and repository URLs, indicating a potential fork or rebranding.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request is a major overhaul, rebranding the project from rc-calendar to @seafile/seafile-calendar, migrating from moment to dayjs, and completely redesigning the UI. It also introduces a new feature for selecting hours and minutes in a side panel. While these are significant improvements, there is a critical regression: keyboard navigation for changing dates has been removed, which severely impacts accessibility. Additionally, there's a critical bug in the new date validation logic that will fail for years after 2068. These issues must be addressed before merging.

Comment on lines +221 to +235
export function validateCalendarYear(yearStr) {
const year = yearStr;
if (!year || isNaN(year)) return getCurrentYear();
if (year.length === 2) {
if (Number(year) >= 0 && Number(year) < 69) {
return year ? `20${year}` : getCurrentYear();
} else if (Number(year) >= 69 && Number(year) < 100) {
return year ? `19${year}` : getCurrentYear();
}
}
if (year.length === 4) {
return year;
}
return year ? year.padStart(4, '0') : getCurrentYear();
}

Choose a reason for hiding this comment

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

critical

Critical Bug: Hardcoded Century Logic

The logic for handling two-digit years contains a hardcoded value (69) to determine the century. This will lead to incorrect date parsing for years after 2068 (e.g., '69' will be parsed as '1969' instead of '2069').

This should be replaced with a dynamic approach, such as a sliding window based on the current year, to avoid this Y2K-style bug.

export function validateCalendarYear(yearStr) {
  const year = yearStr;
  if (!year || isNaN(year)) return getCurrentYear();
  if (year.length === 2) {
    const currentYear = getCurrentYear();
    const currentCentury = Math.floor(currentYear / 100) * 100;
    let twoDigitYear = Number(year);
    // Sliding window: assume year is within 80 years in the past and 20 in the future.
    if (twoDigitYear > (currentYear % 100) + 20) {
      twoDigitYear += currentCentury - 100;
    } else {
      twoDigitYear += currentCentury;
    }
    return String(twoDigitYear);
  }
  if (year.length === 4) {
    return year;
  }
  return year ? year.padStart(4, '0') : getCurrentYear();
}

Comment on lines +137 to +138
event.preventDefault();
event.stopPropagation();

Choose a reason for hiding this comment

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

high

Calling event.preventDefault() and event.stopPropagation() in the default case of a keydown handler is generally not recommended. This will prevent all other unhandled key presses from performing their default browser action (e.g., tabbing to the next element) or propagating, which can lead to unexpected behavior. It's better to only prevent the default action for keys that you are explicitly handling.

Suggested change
event.preventDefault();
event.stopPropagation();
this.props.onKeyDown(event);
return 1;

Comment on lines +760 to +761
# node version
>= 18.20.4

Choose a reason for hiding this comment

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

medium

The requirement for Node.js version >= 18.20.4 is quite specific and recent. Is this a strict requirement for the package to function? To ensure broader compatibility for developers using this library, it's generally recommended to support active LTS (Long-Term Support) versions of Node.js. Consider relaxing this requirement to a broader range, such as >=18 or the lowest compatible LTS version, unless there's a specific feature from 18.20.4 that is essential.

Comment on lines +47 to +51
componentDidMount() {
setTimeout(() => {
this.focus();
}, 100);
}

Choose a reason for hiding this comment

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

medium

Using setTimeout to manage focus is often a code smell and can be unreliable. It suggests a dependency on timing that might fail under different conditions (e.g., on slower devices). A more declarative approach is to use the autoFocus prop directly on the <input> element. This makes the intent clearer and is more robust.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants