Skip to content

Fixed type conversion from DateTime/DateTimeOffset to TimeOnly#9077

Merged
glen-84 merged 2 commits intomainfrom
gai/issue-9075
Jan 29, 2026
Merged

Fixed type conversion from DateTime/DateTimeOffset to TimeOnly#9077
glen-84 merged 2 commits intomainfrom
gai/issue-9075

Conversation

@glen-84
Copy link
Copy Markdown
Member

@glen-84 glen-84 commented Jan 29, 2026

Summary of the changes (Less than 80 chars)

  • Fixed type conversion from DateTime to TimeOnly.

Closes #9075

Copilot AI review requested due to automatic review settings January 29, 2026 15:28
Copy link
Copy Markdown
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 a bug where DateTime to TimeOnly conversion was incorrectly using the .Date property (which sets time to 00:00:00) instead of passing the DateTime directly to TimeOnly.FromDateTime, causing all converted times to be zero. The fix simplifies the lambda to a method reference, which correctly preserves the time component.

Changes:

  • Fixed DateTime to TimeOnly conversion to preserve time component instead of returning zero
  • Simplified DateTime to DateOnly conversion by removing redundant .Date property access
  • Added test to verify DateTime to TimeOnly conversion correctly extracts the time component

Reviewed changes

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

File Description
DefaultTypeConverter.Setup.cs Fixed DateTime to TimeOnly/DateOnly conversions by using method references instead of lambdas that incorrectly used .Date property
TypeConversionTests.cs Added test case to verify DateTime to TimeOnly conversion correctly preserves time component (12:45:10)

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/HotChocolate/Core/src/Types/Utilities/DefaultTypeConverter.Setup.cs Outdated
@github-actions
Copy link
Copy Markdown
Contributor

🚀 Fusion Gateway Performance Results

Simple Composite Query

Constant Load (50 VUs)

Requests/sec Error Rate
5764.91 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.78ms 7.21ms 162.21ms 8.52ms 13.43ms 18.96ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
4543.87 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.78ms 38.32ms 279.99ms 48.85ms 110.31ms 127.38ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
      }
    }
  }
}

Deep Recursion Query

Constant Load (50 VUs)

Requests/sec Error Rate
268.62 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
12.80ms 174.88ms 621.37ms 180.57ms 227.68ms 250.60ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
308.51 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
3.12ms 679.70ms 1709.97ms 685.38ms 1356.44ms 1473.81ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  users {
    ...User
    reviews {
      ...Review
      product {
        ...Product
        reviews {
          ...Review
          author {
            ...User
            reviews {
              ...Review
              product {
                ...Product
              }
            }
          }
        }
      }
    }
  }
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
        reviews {
          ...Review
          product {
            ...Product
          }
        }
      }
    }
  }
}

Variable Batching Throughput

Constant Load (50 VUs)

Requests/sec Error Rate
23809.01 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 1.69ms 42.39ms 2.05ms 3.89ms 4.75ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
18850.91 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 9.16ms 117.45ms 11.20ms 23.12ms 27.87ms

Executed Query

query TestQuery_8f7a46ce_2(
  $__fusion_1_upc: ID!
  $__fusion_2_price: Long!
  $__fusion_2_weight: Long!
) {
  productByUpc(upc: $__fusion_1_upc) {
    inStock
    shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
  }
}

Variables (5 sets batched in single request)

[
  { "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
  { "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
  { "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]

No baseline data available for comparison.


Run 21484137294 • Commit 9d8916b • Thu, 29 Jan 2026 15:46:26 GMT

@glen-84 glen-84 changed the title Fixed type conversion from DateTime to TimeOnly Fixed type conversion from DateTime/DateTimeOffset to TimeOnly Jan 29, 2026
@glen-84 glen-84 requested a review from Copilot January 29, 2026 15:49
Copy link
Copy Markdown
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 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@glen-84 glen-84 added the 🍒 cherry-pick Consider cherry-picking these changes into the previous major version. label Jan 29, 2026
@glen-84 glen-84 merged commit eb4ce9e into main Jan 29, 2026
121 of 122 checks passed
@glen-84 glen-84 deleted the gai/issue-9075 branch January 29, 2026 16:00
@codecov
Copy link
Copy Markdown

codecov Bot commented Jan 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 0.00%. Comparing base (cf15002) to head (f2edaf1).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@     Coverage Diff      @@
##   main   #9077   +/-   ##
============================
============================

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Copy Markdown
Contributor

🚀 Fusion Gateway Performance Results

Simple Composite Query

Constant Load (50 VUs)

Requests/sec Error Rate
5759.47 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.84ms 7.20ms 163.65ms 8.53ms 13.34ms 19.10ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
4533.18 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.83ms 39.00ms 248.25ms 48.98ms 110.41ms 127.60ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
      }
    }
  }
}

Deep Recursion Query

Constant Load (50 VUs)

Requests/sec Error Rate
268.21 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
12.80ms 174.12ms 626.01ms 180.74ms 224.74ms 247.90ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
305.25 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
3.01ms 683.01ms 1736.53ms 689.80ms 1385.94ms 1478.36ms

Executed Query

fragment User on User {
  id
  username
  name
}

fragment Review on Review {
  id
  body
}

fragment Product on Product {
  inStock
  name
  price
  shippingEstimate
  upc
  weight
}

query TestQuery {
  users {
    ...User
    reviews {
      ...Review
      product {
        ...Product
        reviews {
          ...Review
          author {
            ...User
            reviews {
              ...Review
              product {
                ...Product
              }
            }
          }
        }
      }
    }
  }
  topProducts(first: 5) {
    ...Product
    reviews {
      ...Review
      author {
        ...User
        reviews {
          ...Review
          product {
            ...Product
          }
        }
      }
    }
  }
}

Variable Batching Throughput

Constant Load (50 VUs)

Requests/sec Error Rate
23612.86 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 1.71ms 42.88ms 2.07ms 3.92ms 4.79ms

Ramping Load (0→50→500→50 VUs)

Requests/sec Error Rate
18716.04 req/s 0.00%
📊 Response Time Metrics
Min Med Max Avg P90 P95
0.09ms 9.26ms 103.48ms 11.23ms 23.24ms 27.99ms

Executed Query

query TestQuery_8f7a46ce_2(
  $__fusion_1_upc: ID!
  $__fusion_2_price: Long!
  $__fusion_2_weight: Long!
) {
  productByUpc(upc: $__fusion_1_upc) {
    inStock
    shippingEstimate(weight: $__fusion_2_weight, price: $__fusion_2_price)
  }
}

Variables (5 sets batched in single request)

[
  { "__fusion_1_upc": "1", "__fusion_2_price": 899, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "2", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 },
  { "__fusion_1_upc": "3", "__fusion_2_price": 15, "__fusion_2_weight": 20 },
  { "__fusion_1_upc": "4", "__fusion_2_price": 499, "__fusion_2_weight": 100 },
  { "__fusion_1_upc": "5", "__fusion_2_price": 1299, "__fusion_2_weight": 1000 }
]

No baseline data available for comparison.


Run 21484824763 • Commit 34ebce2 • Thu, 29 Jan 2026 16:06:02 GMT

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

Labels

🍒 cherry-pick Consider cherry-picking these changes into the previous major version. 🌶️ hot chocolate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DateTime to TimeOnly conversion always returns zero

2 participants