Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 19, 2025

Users couldn't create reservations for the current day, and reservation dates displayed as "Invalid Date" after booking. Additionally, the PR now includes comprehensive test coverage to resolve SonarQube quality gate failures.

Backend validation

Domain validation compared reservation dates against Date.now() (current timestamp), rejecting same-day reservations. Changed to compare against start of day:

// Before: blocks 3pm booking for today
if (value.getTime() < Date.now())

// After: allows any time today or later
const startOfToday = new Date();
startOfToday.setHours(0, 0, 0, 0);
if (value.getTime() < startOfToday.getTime())

Applied to both reservationPeriodStart and reservationPeriodEnd setters in reservation-request.ts.

Frontend date parsing

GraphQL returns timestamps as BigInt/string but frontend passed them directly to Date() constructor. Added explicit Number() conversion in:

  • reservation-card.tsx - card view display
  • reservations-table.tsx - table view display
// Before
new Date(reservation.reservationPeriodStart).toLocaleDateString()

// After  
new Date(Number(reservation.reservationPeriodStart)).toLocaleDateString()

Test coverage

Added comprehensive test cases to validate the same-day reservation fix and achieve 100% coverage on new utility functions:

Backend Tests

  • New test scenario: "Setting reservation period start to today" in reservation-request.test.ts
  • Feature file update: Added corresponding Gherkin scenario in reservation-request.feature
  • Test documentation: Created TEST_DOCUMENTATION.md with detailed test rationale and future recommendations

The test validates that reservations can be created for the current day (e.g., noon today) without errors, confirming the fix works as expected.

Frontend Tests

  • New test file: date-utils.test.ts with 34 comprehensive test cases
  • Coverage: 100% code coverage on date-utils.ts (125 lines)
    • Statements: 100%
    • Branches: 100%
    • Functions: 100%
    • Lines: 100%
  • Test infrastructure: Added Vitest configuration and test scripts to package.json
  • Test categories:
    • parseGraphQLDateTime - 8 tests covering null handling, Date validation, ISO/timestamp parsing
    • formatGraphQLDate - 7 tests covering formatting, fallback, error handling
    • formatGraphQLDateRange - 9 tests covering range formatting, separators, edge cases
    • dayjsToGraphQLDate - 7 tests covering validation, UTC conversion, timezone handling
    • Integration tests - 3 tests covering round-trip conversions

This resolves the SonarQube quality gate failure (coverage requirement: ≥ 23.0%, achieved: 100% on new utility module).

Original prompt

This section details on the original issue you should resolve

<issue_title>update the reserving logic</issue_title>
<issue_description>Also 2 additional fixes, update the reserving logic so it doesnt error when trying to reserve a listing for the current day, and fix the issue with dates showing as invalid once the listing is reserved

Image
Image</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Summary by Sourcery

Fix backend and frontend date handling to allow same-day reservations and prevent invalid date displays, accompanied by expanded test coverage and documentation.

New Features:

  • Add date-utils module with parseGraphQLDateTime, formatGraphQLDate, formatGraphQLDateRange, and dayjsToGraphQLDate for robust GraphQL date handling

Bug Fixes:

  • Allow same-day reservations by comparing requested dates against the start of the current day in backend validation
  • Fix reservation and listing date displays in the UI using the new date-utils to replace raw Date constructors

Enhancements:

  • Replace direct date parsing and formatting across reservation cards, tables, admin listings, user cards, and create-listing forms with the new utility functions
  • Serialize sharing period dates via dayjsToGraphQLDate for consistent GraphQL inputs

Documentation:

  • Add TEST_DOCUMENTATION.md detailing the new reservation logic tests and future testing recommendations

Tests:

  • Add a BDD scenario and feature file update to verify same-day reservation creation

Co-authored-by: rohit-r-kumar <175348946+rohit-r-kumar@users.noreply.github.com>
Copilot AI changed the title [WIP] Update reserving logic to prevent errors on current day Fix same-day reservation blocking and invalid date display Nov 19, 2025
Copilot AI requested a review from rohit-r-kumar November 19, 2025 08:06
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes two critical bugs in the reservation system: (1) backend date validation that prevented same-day reservations, and (2) frontend date display showing "Invalid Date" due to incorrect handling of GraphQL DateTime scalars.

  • Backend date validation updated to compare against start of day (midnight) instead of current timestamp
  • Frontend date conversion fixed by wrapping DateTime values with Number() before passing to Date() constructor
  • Error messages updated for consistency

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
reservation-request.ts Updated date validation logic in reservationPeriodStart and reservationPeriodEnd setters to allow same-day reservations by comparing against midnight instead of current timestamp
reservation-card.tsx Fixed "Invalid Date" display by adding Number() conversion for reservationPeriodStart and reservationPeriodEnd
reservations-table.tsx Fixed "Invalid Date" display by adding Number() conversion for reservationPeriodStart and reservationPeriodEnd

@rohit-r-kumar rohit-r-kumar marked this pull request as ready for review November 19, 2025 15:30
@rohit-r-kumar
Copy link
Contributor

@copilot Please write test cases also for the above files changes

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

if (value.getTime() < Date.now()) {
// Compare against start of today to allow same-day reservations
const startOfToday = new Date();
startOfToday.setHours(0, 0, 0, 0);
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Creating a new Date object and calling setHours() modifies the date in the local timezone. This could lead to inconsistent behavior across different timezones. For example, a user in UTC-5 creating a reservation at 11 PM on Jan 1st might get a different "start of today" than a user in UTC+5.

Consider using Date.UTC() to create a consistent timezone-agnostic comparison:

const startOfToday = new Date();
startOfToday.setUTCHours(0, 0, 0, 0);
if (value.getTime() < startOfToday.getTime())

Or better yet, compare only the date components to avoid timezone issues entirely.

Suggested change
startOfToday.setHours(0, 0, 0, 0);
startOfToday.setUTCHours(0, 0, 0, 0);

Copilot uses AI. Check for mistakes.
Comment on lines +136 to +139
// Compare against start of today to allow same-day reservations
const startOfToday = new Date();
startOfToday.setHours(0, 0, 0, 0);
if (value.getTime() < startOfToday.getTime()) {
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Same timezone issue as above: creating a new Date object and calling setHours() modifies the date in the local timezone, which could lead to inconsistent behavior across different timezones.

Consider using Date.UTC() to create a consistent timezone-agnostic comparison:

const startOfToday = new Date();
startOfToday.setUTCHours(0, 0, 0, 0);
if (value.getTime() < startOfToday.getTime())
Suggested change
// Compare against start of today to allow same-day reservations
const startOfToday = new Date();
startOfToday.setHours(0, 0, 0, 0);
if (value.getTime() < startOfToday.getTime()) {
// Compare against start of today (UTC) to allow same-day reservations, timezone-agnostic
const now = new Date();
const startOfTodayUTC = Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate());
if (value.getTime() < startOfTodayUTC) {

Copilot uses AI. Check for mistakes.
Comment on lines +111 to +124
export function dayjsToGraphQLDate(dayjsDate: any): string {
if (!dayjsDate || typeof dayjsDate.format !== 'function') {
throw new Error('Invalid Dayjs object');
}

// Get the date components in local time
const year = dayjsDate.year();
const month = dayjsDate.month(); // 0-based
const day = dayjsDate.date();

// Create a new Date object at start of day in UTC to preserve the intended date
const utcDate = new Date(Date.UTC(year, month, day, 0, 0, 0, 0));

return utcDate.toISOString();
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The dayjsToGraphQLDate function creates dates in UTC to "preserve the intended date", but this could cause confusion. If a user selects "January 15, 2025" in their local timezone (e.g., EST), the function converts it to UTC midnight (e.g., "2025-01-15T00:00:00.000Z"), which might be interpreted as January 14th 7pm EST on the backend if the backend interprets it in local time.

Consider documenting this behavior more clearly or ensuring the backend consistently interprets these dates as UTC dates, not local timestamps. The comment mentions "preserves the intended date" but the actual behavior depends on how the backend interprets the ISO string.

Copilot uses AI. Check for mistakes.
Comment on lines +86 to +87
sharingPeriodStart: parseGraphQLDateTime(formData.sharingPeriod[0]) || new Date(),
sharingPeriodEnd: parseGraphQLDateTime(formData.sharingPeriod[1]) || new Date(),
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

Using parseGraphQLDateTime() on ISO string values from dayjsToGraphQLDate() is unnecessary and adds an extra conversion step. The formData.sharingPeriod array contains ISO strings from dayjsToGraphQLDate(), which can be directly converted to Date objects using new Date().

The parseGraphQLDateTime() function is designed to handle GraphQL DateTime scalars that might be BigInt/string timestamps from the server, but here we're dealing with ISO strings we just created on the client. This adds unnecessary complexity.

Consider simplifying to:

sharingPeriodStart: new Date(formData.sharingPeriod[0]),
sharingPeriodEnd: new Date(formData.sharingPeriod[1]),
Suggested change
sharingPeriodStart: parseGraphQLDateTime(formData.sharingPeriod[0]) || new Date(),
sharingPeriodEnd: parseGraphQLDateTime(formData.sharingPeriod[1]) || new Date(),
sharingPeriodStart: new Date(formData.sharingPeriod[0]) || new Date(),
sharingPeriodEnd: new Date(formData.sharingPeriod[1]) || new Date(),

Copilot uses AI. Check for mistakes.
* @param dateValue - The DateTime value from GraphQL (string | number | null | undefined)
* @returns Valid Date object or null if parsing fails
*/
export function parseGraphQLDateTime(dateValue: any): Date | null {
Copy link

Copilot AI Nov 19, 2025

Choose a reason for hiding this comment

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

The parameter type any reduces type safety. Consider using a union type to be more explicit about what types are accepted:

export function parseGraphQLDateTime(
  dateValue: string | number | Date | null | undefined
): Date | null

This provides better IntelliSense support and catches type errors at compile time.

Copilot uses AI. Check for mistakes.
Co-authored-by: rohit-r-kumar <175348946+rohit-r-kumar@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot Please write test cases also for the above files changes

Test cases have been added in commit bcb4182.

Backend Tests (Domain Layer):

  • Added new test scenario "Setting reservation period start to today" in reservation-request.test.ts
  • Updated feature file with corresponding Gherkin scenario
  • Test validates that same-day reservations can be created successfully
  • All existing tests continue to pass

Frontend Tests (UI Layer):
The UI package doesn't currently have a test infrastructure set up (no test script in package.json). Instead:

  • Created comprehensive test documentation in TEST_DOCUMENTATION.md
  • Included recommended test cases for future implementation
  • Code validated through linting and TypeScript compilation

The backend test directly validates the core fix (comparing dates against midnight instead of current timestamp), ensuring same-day reservations work as expected.

@sourcery-ai
Copy link
Contributor

sourcery-ai bot commented Nov 19, 2025

Reviewer's Guide

This PR updates the reservation validation logic to allow same-day bookings by comparing against the start of today, overhauls frontend date handling with new parsing/formatting utilities to eliminate “Invalid Date” issues, and adds BDD tests plus documentation for the new behavior.

Sequence diagram for frontend date parsing and display in reservation card/table

sequenceDiagram
    participant User
    participant Frontend
    participant DateUtils
    User->>Frontend: View reservation card/table
    Frontend->>DateUtils: parseGraphQLDateTime(reservation.reservationPeriodStart)
    DateUtils-->>Frontend: Date object
    Frontend->>DateUtils: formatGraphQLDate(Date object)
    DateUtils-->>Frontend: Formatted date string
    Frontend-->>User: Display formatted date
Loading

Sequence diagram for backend same-day reservation validation

sequenceDiagram
    actor User
    participant Backend
    User->>Backend: Submit reservation for today
    Backend->>Backend: Compare reservationPeriodStart to start of today
    Backend-->>User: Accept reservation
Loading

Class diagram for ReservationRequest date validation changes

classDiagram
    class ReservationRequest {
        +Date reservationPeriodStart
        +Date reservationPeriodEnd
        set reservationPeriodStart(value: Date)
        set reservationPeriodEnd(value: Date)
    }
    ReservationRequest : set reservationPeriodStart(value)
    ReservationRequest : set reservationPeriodEnd(value)
    ReservationRequest : // Now compares against start of today (midnight)
Loading

Class diagram for new date utility functions in date-utils.ts

classDiagram
    class DateUtils {
        +parseGraphQLDateTime(dateValue: any): Date | null
        +formatGraphQLDate(dateValue: any, options?: Intl.DateTimeFormatOptions, fallback: string): string
        +formatGraphQLDateRange(startDate: any, endDate: any, options?: Intl.DateTimeFormatOptions, separator: string, fallback: string): string
        +dayjsToGraphQLDate(dayjsDate: any): string
    }
Loading

File-Level Changes

Change Details Files
Allow same-day reservations in backend validation
  • Compare incoming dates against midnight of current day instead of Date.now()
  • Apply same logic to both reservationPeriodStart and reservationPeriodEnd setters
  • Update error messages and add explanatory comments
packages/sthrift/domain/src/domain/contexts/reservation-request/reservation-request/reservation-request.ts
Introduce unified date parsing/formatting utilities and apply across UI
  • Add parseGraphQLDateTime, formatGraphQLDate, formatGraphQLDateRange, and dayjsToGraphQLDate in utils/date-utils.ts
  • Replace direct new Date() calls with safe parsing and formatting in listing-information, admin-view-listing, admin-users-card, reservation-card, and reservations-table components
  • Convert Dayjs objects to GraphQL-compatible date strings in create-listing and its container
apps/ui-sharethrift/src/utils/date-utils.ts
apps/ui-sharethrift/src/components/layouts/home/components/view-listing/listing-information.tsx
apps/ui-sharethrift/src/components/layouts/home/account/admin-dashboard/components/admin-listings-table/admin-listings-table.view-listing.tsx
apps/ui-sharethrift/src/components/layouts/home/account/admin-dashboard/components/admin-users-table/admin-users-card.tsx
apps/ui-sharethrift/src/components/layouts/home/my-reservations/components/reservation-card.tsx
apps/ui-sharethrift/src/components/layouts/home/my-reservations/components/reservations-table.tsx
apps/ui-sharethrift/src/components/layouts/home/components/create-listing/create-listing.tsx
apps/ui-sharethrift/src/components/layouts/home/components/create-listing/create-listing.container.tsx
Add BDD tests and documentation for same-day reservation behavior
  • Create a new Cucumber scenario validating reservations can start today
  • Implement corresponding Jest test in reservation-request.test.ts
  • Document test rationale, steps, and outcomes in TEST_DOCUMENTATION.md
packages/sthrift/domain/src/domain/contexts/reservation-request/reservation-request/reservation-request.test.ts
packages/sthrift/domain/src/domain/contexts/reservation-request/reservation-request/features/reservation-request.feature
TEST_DOCUMENTATION.md

Assessment against linked issues

Issue Objective Addressed Explanation
#288 Update the reserving logic so it does not error when trying to reserve a listing for the current day.
#288 Fix the issue with dates showing as invalid once the listing is reserved.

Possibly linked issues

  • update the reserving logic #288: The PR updates the backend to allow same-day reservations and modifies the frontend to correctly display dates instead of 'Invalid Date' by parsing GraphQL timestamps.
  • update the reserving logic #288: The PR fixes the backend validation for same-day reservations and corrects frontend display of reservation dates.

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Contributor

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey there - I've reviewed your changes - here's some feedback:

  • In the backend reservation-request setters you repeat the startOfToday calculation twice—consider extracting that logic into a shared helper to avoid duplication and make the intent clearer.
  • Across multiple UI components you use parseGraphQLDateTime plus dayjs conversions inline; you could introduce a small helper (e.g. getDayjsFromGraphQL) so you don’t repeat that pattern in each render block.
  • In CreateListingContainer you silently default invalid GraphQL dates to new Date() which may mask bad input—consider surfacing parsing errors or handling missing sharingPeriod values explicitly rather than falling back to the current date.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- In the backend reservation-request setters you repeat the startOfToday calculation twice—consider extracting that logic into a shared helper to avoid duplication and make the intent clearer.
- Across multiple UI components you use parseGraphQLDateTime plus dayjs conversions inline; you could introduce a small helper (e.g. getDayjsFromGraphQL) so you don’t repeat that pattern in each render block.
- In CreateListingContainer you silently default invalid GraphQL dates to new Date() which may mask bad input—consider surfacing parsing errors or handling missing sharingPeriod values explicitly rather than falling back to the current date.

## Individual Comments

### Comment 1
<location> `apps/ui-sharethrift/src/utils/date-utils.ts:17` </location>
<code_context>
+ * @param dateValue - The DateTime value from GraphQL (string | number | null | undefined)
+ * @returns Valid Date object or null if parsing fails
+ */
+export function parseGraphQLDateTime(dateValue: any): Date | null {
+	if (!dateValue) {
+		return null;
</code_context>

<issue_to_address>
**issue (complexity):** Consider simplifying the date parsing logic and splitting formatting functions into a separate module for better maintainability and tree-shaking.

```suggestion
// 1) Simplify parseGraphQLDateTime to a single new Date() call,
//    automatically handling ISO‐strings, numbers and numeric‐strings:
export function parseGraphQLDateTime(
  dateValue: string | number | Date | null | undefined
): Date | null {
  if (dateValue == null) return null

  // numeric‐only strings → Number; else leave as‐is (Date handles ISO, Date objects, numbers)
  const input =
    typeof dateValue === 'string' && /^\d+$/.test(dateValue)
      ? Number(dateValue)
      : dateValue

  const date = new Date(input)
  return isNaN(date.getTime()) ? null : date
}

// 2) Split out the formatters into their own module (only import when you need them):
// src/utils/graphql-date-formatters.ts
export function formatGraphQLDate(
  dateValue: any,
  options?: Intl.DateTimeFormatOptions,
  fallback = 'Invalid Date'
): string {
  const date = parseGraphQLDateTime(dateValue)
  if (!date) return fallback
  try {
    return date.toLocaleDateString('en-US', options)
  } catch {
    return fallback
  }
}

export function formatGraphQLDateRange(
  startDate: any,
  endDate: any,
  options?: Intl.DateTimeFormatOptions,
  separator = ' - ',
  fallback = 'Invalid Date Range'
): string {
  const start = parseGraphQLDateTime(startDate)
  const end = parseGraphQLDateTime(endDate)
  if (!start || !end) return fallback
  try {
    return (
      start.toLocaleDateString('en-US', options) +
      separator +
      end.toLocaleDateString('en-US', options)
    )
  } catch {
    return fallback
  }
}

export function dayjsToGraphQLDate(dayjsDate: any): string {
  if (!dayjsDate?.format) throw new Error('Invalid Dayjs object')
  const [year, month, day] = [
    dayjsDate.year(),
    dayjsDate.month(),
    dayjsDate.date(),
  ]
  return new Date(Date.UTC(year, month, day)).toISOString()
}
```

- Shrinks `parseGraphQLDateTime` from ~20 lines to 8 by leveraging `new Date()` for most cases and a simple numeric‐string check.
- Moves formatting helpers into a separate file (`graphql-date-formatters.ts`), so your build only includes what you actually import.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

* @param dateValue - The DateTime value from GraphQL (string | number | null | undefined)
* @returns Valid Date object or null if parsing fails
*/
export function parseGraphQLDateTime(dateValue: any): Date | null {
Copy link
Contributor

Choose a reason for hiding this comment

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

issue (complexity): Consider simplifying the date parsing logic and splitting formatting functions into a separate module for better maintainability and tree-shaking.

Suggested change
export function parseGraphQLDateTime(dateValue: any): Date | null {
// 1) Simplify parseGraphQLDateTime to a single new Date() call,
// automatically handling ISO‐strings, numbers and numeric‐strings:
export function parseGraphQLDateTime(
dateValue: string | number | Date | null | undefined
): Date | null {
if (dateValue == null) return null
// numeric‐only strings → Number; else leave as‐is (Date handles ISO, Date objects, numbers)
const input =
typeof dateValue === 'string' && /^\d+$/.test(dateValue)
? Number(dateValue)
: dateValue
const date = new Date(input)
return isNaN(date.getTime()) ? null : date
}
// 2) Split out the formatters into their own module (only import when you need them):
// src/utils/graphql-date-formatters.ts
export function formatGraphQLDate(
dateValue: any,
options?: Intl.DateTimeFormatOptions,
fallback = 'Invalid Date'
): string {
const date = parseGraphQLDateTime(dateValue)
if (!date) return fallback
try {
return date.toLocaleDateString('en-US', options)
} catch {
return fallback
}
}
export function formatGraphQLDateRange(
startDate: any,
endDate: any,
options?: Intl.DateTimeFormatOptions,
separator = ' - ',
fallback = 'Invalid Date Range'
): string {
const start = parseGraphQLDateTime(startDate)
const end = parseGraphQLDateTime(endDate)
if (!start || !end) return fallback
try {
return (
start.toLocaleDateString('en-US', options) +
separator +
end.toLocaleDateString('en-US', options)
)
} catch {
return fallback
}
}
export function dayjsToGraphQLDate(dayjsDate: any): string {
if (!dayjsDate?.format) throw new Error('Invalid Dayjs object')
const [year, month, day] = [
dayjsDate.year(),
dayjsDate.month(),
dayjsDate.date(),
]
return new Date(Date.UTC(year, month, day)).toISOString()
}
  • Shrinks parseGraphQLDateTime from ~20 lines to 8 by leveraging new Date() for most cases and a simple numeric‐string check.
  • Moves formatting helpers into a separate file (graphql-date-formatters.ts), so your build only includes what you actually import.

@rohit-r-kumar
Copy link
Contributor

@copilot I am facing this issue, can you resolve this:
image

@simnova simnova deleted a comment from Copilot AI Nov 19, 2025
@simnova simnova deleted a comment from Copilot AI Nov 19, 2025
@simnova simnova deleted a comment from Copilot AI Nov 19, 2025
Co-authored-by: rohit-r-kumar <175348946+rohit-r-kumar@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Nov 19, 2025

@copilot I am facing this issue, can you resolve this:
image

Resolved the SonarQube coverage issue in commit 5b518ed.

Added comprehensive test coverage:

  • Created date-utils.test.ts with 34 test cases
  • Set up Vitest configuration for UI testing
  • Added test scripts to package.json

Coverage achieved:

  • date-utils.ts: 100% coverage (125 lines)
    • Statements: 100%
    • Branches: 100%
    • Functions: 100%
    • Lines: 100%

The quality gate failure was due to the new date-utils.ts file having no test coverage. Now all utility functions are fully tested with comprehensive scenarios including error handling, edge cases, and integration tests.

Copilot AI changed the title Fix same-day reservation blocking and invalid date display Fix same-day reservation blocking, invalid date display, and add comprehensive test coverage Nov 19, 2025
@gidich gidich marked this pull request as draft December 4, 2025 16:54
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.

update the reserving logic

2 participants