Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: stephenh/ts-proto
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.8.0
Choose a base ref
...
head repository: stephenh/ts-proto
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.8.1
Choose a head ref
  • 2 commits
  • 7 files changed
  • 2 contributors

Commits on Oct 22, 2025

  1. fix: fix double division, fix loss of millisecond unit (#1221)

    This PR fixes an issue I introduced in the initial `useDate=temporal` PR
    [here](#1219). The generated
    code for `toTimestamp` was dividing the `epochMilliseconds` twice,
    causing the date to get truncated to `1970-01-01`, so the tests would
    seem to work for dates.
    
    There was _also_ a bug in how `nanos` was calculated:
    ```typescript
    Temporal.Instant
        .fromEpochMilliseconds(instant.epochMilliseconds)
        .until(instant);
    ```
    since we were deriving the start date from `epochMilliseconds`, so the
    remainder only included micro/nanoseconds (milliseconds were always
    `000`).
    
    The PR addresses the first issue by ensuring we only divide once, in the
    generated `seconds` code. It fixes the latter by using the built-in
    [Temporal.Instant.prototype.round](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Temporal/Instant/round)
    method to round to the nearest second without needing to do any explicit
    math.
    
    Lastly, it also updates the tests, as the `toStrictEqual` check was
    succeeding even for `Instant`s whose string representations were clearly
    different, so now we will test against the output string.
    confusingstraw authored Oct 22, 2025
    Configuration menu
    Copy the full SHA
    d25e922 View commit details
    Browse the repository at this point in the history
  2. chore(release): 2.8.1 [skip ci]

    ## [2.8.1](v2.8.0...v2.8.1) (2025-10-22)
    
    ### Bug Fixes
    
    * fix double division, fix loss of millisecond unit ([#1221](#1221)) ([d25e922](d25e922))
    semantic-release-bot committed Oct 22, 2025
    Configuration menu
    Copy the full SHA
    acdb186 View commit details
    Browse the repository at this point in the history
Loading