From f9b1307f0da504d333f6f83c47fd7a0f36e90e7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Garc=C3=ADa?= Date: Tue, 26 May 2026 12:05:15 -0600 Subject: [PATCH 1/2] chore: upgrade nitro modules to 0.35 --- package.json | 2 +- packages/example/ios/Podfile.lock | 8 ++-- packages/example/package.json | 2 +- packages/expo-example/package.json | 2 +- .../android/src/main/cpp/cpp-adapter.cpp | 5 +- packages/native-date/nitro.json | 6 ++- packages/native-date/package.json | 6 +-- yarn.lock | 48 +++++++++---------- 8 files changed, 43 insertions(+), 36 deletions(-) diff --git a/package.json b/package.json index e368998..8378354 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "packages/*" ], "scripts": { - "native-date": "yarn workspace @rn-packages/native-date", + "native-date": "yarn workspace @bernagl/react-native-date", "prepare": "yarn native-date prepare", "docs:dev": "vitepress dev docs", "docs:build": "vitepress build docs", diff --git a/packages/example/ios/Podfile.lock b/packages/example/ios/Podfile.lock index 1a2dde3..bc86f6d 100644 --- a/packages/example/ios/Podfile.lock +++ b/packages/example/ios/Podfile.lock @@ -8,7 +8,7 @@ PODS: - hermes-engine (0.81.1): - hermes-engine/Pre-built (= 0.81.1) - hermes-engine/Pre-built (0.81.1) - - NativeDate (1.0.0): + - NativeDate (2.0.0): - boost - DoubleConversion - fast_float @@ -38,7 +38,7 @@ PODS: - ReactCommon/turbomodule/core - SocketRocket - Yoga - - NitroModules (0.31.10): + - NitroModules (0.35.7): - boost - DoubleConversion - fast_float @@ -2553,8 +2553,8 @@ SPEC CHECKSUMS: fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd glog: 5683914934d5b6e4240e497e0f4a3b42d1854183 hermes-engine: 4f8246b1f6d79f625e0d99472d1f3a71da4d28ca - NativeDate: 1750ff7f7c77731145e1ef0e166e1c3c363df987 - NitroModules: 5bc319d441f4983894ea66b1d392c519536e6d23 + NativeDate: b94bbbf65b376b67c222ba731982d54922c6b480 + NitroModules: 9ec4a2e0b9af22ba1f1f550e1dd9be94143afd18 RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669 RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077 RCTRequired: e97dd5dafc1db8094e63bc5031e0371f092ae92a diff --git a/packages/example/package.json b/packages/example/package.json index e42a337..c4a90ec 100644 --- a/packages/example/package.json +++ b/packages/example/package.json @@ -18,7 +18,7 @@ "luxon": "^3.5.0", "react": "19.1.0", "react-native": "0.81.1", - "react-native-nitro-modules": "^0.31.10" + "react-native-nitro-modules": "0.35.7" }, "devDependencies": { "@babel/core": "^7.25.2", diff --git a/packages/expo-example/package.json b/packages/expo-example/package.json index b1ef7b2..ce99920 100644 --- a/packages/expo-example/package.json +++ b/packages/expo-example/package.json @@ -19,7 +19,7 @@ "expo-status-bar": "~3.0.9", "react": "19.1.0", "react-native": "0.81.5", - "react-native-nitro-modules": "^0.31.10" + "react-native-nitro-modules": "0.35.7" }, "devDependencies": { "@types/react": "~19.1.0", diff --git a/packages/native-date/android/src/main/cpp/cpp-adapter.cpp b/packages/native-date/android/src/main/cpp/cpp-adapter.cpp index 180d28c..0562c85 100644 --- a/packages/native-date/android/src/main/cpp/cpp-adapter.cpp +++ b/packages/native-date/android/src/main/cpp/cpp-adapter.cpp @@ -1,4 +1,5 @@ #include +#include #include "rnpackages_nativedateOnLoad.hpp" // Forward declarations for platform helpers @@ -12,5 +13,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) { LocaleHelper_setJavaVM(vm); RelativeTimeHelper_setJavaVM(vm); - return margelo::nitro::rnpackages_nativedate::initialize(vm); + return facebook::jni::initialize(vm, []() { + margelo::nitro::rnpackages_nativedate::registerAllNatives(); + }); } diff --git a/packages/native-date/nitro.json b/packages/native-date/nitro.json index 1dcd64e..8557511 100644 --- a/packages/native-date/nitro.json +++ b/packages/native-date/nitro.json @@ -1,4 +1,5 @@ { + "$schema": "https://nitro.margelo.com/nitro.schema.json", "cxxNamespace": ["rnpackages_nativedate"], "ios": { "iosModuleName": "NativeDate" @@ -9,7 +10,10 @@ }, "autolinking": { "NativeDate": { - "cpp": "HybridNativeDate" + "all": { + "language": "c++", + "implementationClassName": "HybridNativeDate" + } } }, "ignorePaths": ["node_modules"] diff --git a/packages/native-date/package.json b/packages/native-date/package.json index 603a697..91239c5 100644 --- a/packages/native-date/package.json +++ b/packages/native-date/package.json @@ -112,12 +112,12 @@ "eslint-plugin-react-native": "^5.0.0", "jest": "^30.2.0", "lefthook": "^2.0.3", - "nitrogen": "^0.31.10", + "nitrogen": "0.35.7", "prettier": "^2.8.8", "react": "19.1.0", "react-native": "0.81.1", "react-native-builder-bob": "^0.40.16", - "react-native-nitro-modules": "^0.31.10", + "react-native-nitro-modules": "0.35.7", "ts-jest": "^29.4.6", "turbo": "^2.5.6", "typescript": "^5.9.2" @@ -125,7 +125,7 @@ "peerDependencies": { "react": "*", "react-native": "*", - "react-native-nitro-modules": "^0.31.10" + "react-native-nitro-modules": ">=0.35.0 <0.36.0" }, "react-native-builder-bob": { "source": "src", diff --git a/yarn.lock b/yarn.lock index 3ef64da..eaafc41 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1811,19 +1811,19 @@ __metadata: eslint-plugin-react-native: "npm:^5.0.0" jest: "npm:^30.2.0" lefthook: "npm:^2.0.3" - nitrogen: "npm:^0.31.10" + nitrogen: "npm:0.35.7" prettier: "npm:^2.8.8" react: "npm:19.1.0" react-native: "npm:0.81.1" react-native-builder-bob: "npm:^0.40.16" - react-native-nitro-modules: "npm:^0.31.10" + react-native-nitro-modules: "npm:0.35.7" ts-jest: "npm:^29.4.6" turbo: "npm:^2.5.6" typescript: "npm:^5.9.2" peerDependencies: react: "*" react-native: "*" - react-native-nitro-modules: ^0.31.10 + react-native-nitro-modules: ">=0.35.0 <0.36.0" languageName: unknown linkType: soft @@ -4023,7 +4023,7 @@ __metadata: expo-status-bar: "npm:~3.0.9" react: "npm:19.1.0" react-native: "npm:0.81.5" - react-native-nitro-modules: "npm:^0.31.10" + react-native-nitro-modules: "npm:0.35.7" typescript: "npm:~5.9.2" languageName: unknown linkType: soft @@ -4053,7 +4053,7 @@ __metadata: react-native: "npm:0.81.1" react-native-builder-bob: "npm:^0.40.16" react-native-monorepo-config: "npm:^0.1.9" - react-native-nitro-modules: "npm:^0.31.10" + react-native-nitro-modules: "npm:0.35.7" languageName: unknown linkType: soft @@ -4403,14 +4403,14 @@ __metadata: languageName: node linkType: hard -"@ts-morph/common@npm:~0.28.1": - version: 0.28.1 - resolution: "@ts-morph/common@npm:0.28.1" +"@ts-morph/common@npm:~0.29.0": + version: 0.29.0 + resolution: "@ts-morph/common@npm:0.29.0" dependencies: minimatch: "npm:^10.0.1" path-browserify: "npm:^1.0.1" tinyglobby: "npm:^0.2.14" - checksum: 10c0/d51276d840997e0f8f83e04f8b1689135bb12588a7ddbed575f87848d5737eeae31e242685d6449de27573e8ed30892157fea643393cb875e175f2711200bc50 + checksum: 10c0/97ab8ca66558b817e5475a8893ee1476ab760a3ac71fa9868413d95ddbaaf909eda81716e3a8d14291cbf449e624af66de81bcddd3ec2e36525728b4edf5e8ee languageName: node linkType: hard @@ -11516,18 +11516,18 @@ __metadata: languageName: node linkType: hard -"nitrogen@npm:^0.31.10": - version: 0.31.10 - resolution: "nitrogen@npm:0.31.10" +"nitrogen@npm:0.35.7": + version: 0.35.7 + resolution: "nitrogen@npm:0.35.7" dependencies: chalk: "npm:^5.3.0" - react-native-nitro-modules: "npm:^0.31.10" - ts-morph: "npm:^27.0.0" + react-native-nitro-modules: "npm:^0.35.7" + ts-morph: "npm:^28.0.0" yargs: "npm:^18.0.0" zod: "npm:^4.0.5" bin: nitrogen: lib/index.js - checksum: 10c0/273f6d54e1f7cc29c10988b34240bb9cc8637b86e59af5be2878e04e6c1e495e131b6ddec2d2c9196e4ee9be4c5907213e462da65025a7cbeab9f916ad72926c + checksum: 10c0/1dd8fe72c5d90991038571fc3009489802f0b8d2c760db40cc83b119576e122c5e22a22b0391f0e4cb6fdb178fc389f143c9b16b67be80a14e4617832a6f7fab languageName: node linkType: hard @@ -12469,13 +12469,13 @@ __metadata: languageName: node linkType: hard -"react-native-nitro-modules@npm:^0.31.10": - version: 0.31.10 - resolution: "react-native-nitro-modules@npm:0.31.10" +"react-native-nitro-modules@npm:0.35.7, react-native-nitro-modules@npm:^0.35.7": + version: 0.35.7 + resolution: "react-native-nitro-modules@npm:0.35.7" peerDependencies: react: "*" react-native: "*" - checksum: 10c0/0acc6ca5f12e24a6601e682070f257a771b95214c11fba911b342af705071234544c93076900f43400c8ae2f1a6738011b120e4425813968102997860ffd7626 + checksum: 10c0/f0c9167655032952bfdadd6802eade60796df2021e29a451ec205843dd6e95c6cb274d77c77534703a5d5d55e45c6f7ca1900a94813de3e0bdb0f3aa654cf3fc languageName: node linkType: hard @@ -14013,13 +14013,13 @@ __metadata: languageName: node linkType: hard -"ts-morph@npm:^27.0.0": - version: 27.0.2 - resolution: "ts-morph@npm:27.0.2" +"ts-morph@npm:^28.0.0": + version: 28.0.0 + resolution: "ts-morph@npm:28.0.0" dependencies: - "@ts-morph/common": "npm:~0.28.1" + "@ts-morph/common": "npm:~0.29.0" code-block-writer: "npm:^13.0.3" - checksum: 10c0/224715cc6d97b8ff5afd3986f9629f912a0ebd83eaecbdca91c35cf10a98f607c663f666e7ea5e6afab00563d00dc80fa7a13552cc7f1cef735261c3217d0863 + checksum: 10c0/969570a5e983b4193735fff43878ce7b78787b4860bf3d23f330c86d7de707286969e5a82d486dce333eea27bf9d373a46f9de58a80c0bf86d2a462620563a55 languageName: node linkType: hard From aa6155809c94ae9e6a51cfd6842564d2e3b9b910 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20Garc=C3=ADa?= Date: Tue, 26 May 2026 12:05:15 -0600 Subject: [PATCH 2/2] docs: document nitro modules 0.35 upgrade --- README.md | 2 +- docs/api-reference.md | 6 ++ docs/index.md | 1 + packages/example/ios/Podfile.lock | 4 +- .../src/NativeTestScreen.tsx | 14 +++- packages/native-date/CHANGELOG.md | 22 +++++- packages/native-date/NativeDate.podspec | 2 +- packages/native-date/README.md | 3 + packages/native-date/RELEASE_NOTES_v3.0.0.md | 75 +++++++++++++++++++ packages/native-date/package.json | 4 +- 10 files changed, 123 insertions(+), 10 deletions(-) create mode 100644 packages/native-date/RELEASE_NOTES_v3.0.0.md diff --git a/README.md b/README.md index db88be8..d635dc5 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ npm install @bernagl/react-native-date react-native-nitro-modules cd ios && pod install ``` -**Requirements:** React Native 0.76+ (New Architecture) • iOS 13.0+ • Android API 24+ +**Requirements:** React Native 0.76+ (New Architecture) • Nitro Modules 0.35.x • iOS 13.0+ • Android API 24+ ## Is this library for you? diff --git a/docs/api-reference.md b/docs/api-reference.md index 60e7a64..b4f21d4 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -6,6 +6,12 @@ All functions accept flexible date inputs and return timestamps (milliseconds si type DateInput = number | string | Date; ``` +::: warning v3.0 Native Requirement +v3.0 requires `react-native-nitro-modules >=0.35.0 <0.36.0`. Reinstall pods and rebuild native apps after upgrading. + +See [Release Notes](https://github.com/bbernag/react-native-date/blob/main/packages/native-date/RELEASE_NOTES_v3.0.0.md) for migration steps. +::: + ::: warning v2.0 Breaking Changes - `parse()` now uses **local time** for date-only strings (was UTC) - Getter functions now return **local time** components (was UTC) diff --git a/docs/index.md b/docs/index.md index 6d8f64b..d20102b 100644 --- a/docs/index.md +++ b/docs/index.md @@ -173,6 +173,7 @@ import { nativeDate } from '@bernagl/react-native-date/chain'; | iOS | 13.0+ | | Android | API 24+ (Android 7.0) | | React Native | 0.76+ (New Architecture) | +| Nitro Modules | 0.35.x | --- diff --git a/packages/example/ios/Podfile.lock b/packages/example/ios/Podfile.lock index bc86f6d..61c5c19 100644 --- a/packages/example/ios/Podfile.lock +++ b/packages/example/ios/Podfile.lock @@ -8,7 +8,7 @@ PODS: - hermes-engine (0.81.1): - hermes-engine/Pre-built (= 0.81.1) - hermes-engine/Pre-built (0.81.1) - - NativeDate (2.0.0): + - NativeDate (3.0.0): - boost - DoubleConversion - fast_float @@ -2553,7 +2553,7 @@ SPEC CHECKSUMS: fmt: a40bb5bd0294ea969aaaba240a927bd33d878cdd glog: 5683914934d5b6e4240e497e0f4a3b42d1854183 hermes-engine: 4f8246b1f6d79f625e0d99472d1f3a71da4d28ca - NativeDate: b94bbbf65b376b67c222ba731982d54922c6b480 + NativeDate: 137a302e716121fa55eb344f8b35363590f71a07 NitroModules: 9ec4a2e0b9af22ba1f1f550e1dd9be94143afd18 RCT-Folly: 846fda9475e61ec7bcbf8a3fe81edfcaeb090669 RCTDeprecation: c4b9e2fd0ab200e3af72b013ed6113187c607077 diff --git a/packages/native-date-examples/src/NativeTestScreen.tsx b/packages/native-date-examples/src/NativeTestScreen.tsx index 8e007cb..9819295 100644 --- a/packages/native-date-examples/src/NativeTestScreen.tsx +++ b/packages/native-date-examples/src/NativeTestScreen.tsx @@ -171,6 +171,12 @@ const EARLIER_TS = parse(EARLIER_DATE); const LATER_DATE = '2024-06-20T18:00:00.000Z'; const LATER_TS = parse(LATER_DATE); +const durationIncludesUnit = ( + value: string, + amount: number, + unit: 'd' | 'h' +) => value.replace(/[,\s]/g, '').startsWith(`${amount}${unit}`); + function createTestCategories(): Record { return { Core: { @@ -1313,14 +1319,14 @@ function createTestCategories(): Record { // formatDuration { name: 'formatDuration() 1 hour', - test: () => formatDuration(3600000).includes('1h'), - expected: 'contains "1h"', + test: () => durationIncludesUnit(formatDuration(3600000), 1, 'h'), + expected: 'starts with 1 hour unit', getActual: () => formatDuration(3600000), }, { name: 'formatDuration() 1 day', - test: () => formatDuration(86400000).includes('1d'), - expected: 'contains "1d"', + test: () => durationIncludesUnit(formatDuration(86400000), 1, 'd'), + expected: 'starts with 1 day unit', getActual: () => formatDuration(86400000), }, // toISOString diff --git a/packages/native-date/CHANGELOG.md b/packages/native-date/CHANGELOG.md index 497efa3..ca347e5 100644 --- a/packages/native-date/CHANGELOG.md +++ b/packages/native-date/CHANGELOG.md @@ -7,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [3.0.0] - 2026-05-26 + +### Changed + +- Upgrade Nitro Modules and Nitrogen generation to the 0.35 line. +- Require `react-native-nitro-modules` 0.35.x for native integration. +- Regenerate Nitro native specs with Nitrogen 0.35.7. + +### Fixed + +- Update Android native registration for the Nitro Modules 0.35 runtime contract. +- Relax the example app duration test assertions so native-formatted duration separators do not create false failures. + +### Migration + +- Upgrade consuming apps to `react-native-nitro-modules >=0.35.0 <0.36.0`. +- Reinstall iOS pods and rebuild native apps after upgrading. +- Keep the JavaScript date API unchanged from v2.x. + ## [0.1.0] - 2024-XX-XX ### Added @@ -39,5 +58,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Minimal bridge overhead with Nitro Modules - Benchmark results show 2-22x improvement over date-fns/dayjs for various operations -[Unreleased]: https://github.com/bbernag/react-native-date/compare/v0.1.0...HEAD +[Unreleased]: https://github.com/bbernag/react-native-date/compare/v3.0.0...HEAD +[3.0.0]: https://github.com/bbernag/react-native-date/compare/v2.0.0...v3.0.0 [0.1.0]: https://github.com/bbernag/react-native-date/releases/tag/v0.1.0 diff --git a/packages/native-date/NativeDate.podspec b/packages/native-date/NativeDate.podspec index 780fc5e..1639253 100644 --- a/packages/native-date/NativeDate.podspec +++ b/packages/native-date/NativeDate.podspec @@ -11,7 +11,7 @@ Pod::Spec.new do |s| s.authors = package["author"] s.platforms = { :ios => min_ios_version_supported } - s.source = { :git => "https://github.com/bbernag/react-native-date.git", :tag => "#{s.version}" } + s.source = { :git => "https://github.com/bbernag/react-native-date.git", :tag => "v#{s.version}" } s.source_files = [ "ios/**/*.{m,mm}", diff --git a/packages/native-date/README.md b/packages/native-date/README.md index 2c12527..7fe2d89 100644 --- a/packages/native-date/README.md +++ b/packages/native-date/README.md @@ -2,6 +2,8 @@ High-performance native date library for React Native, powered by C++ and [Nitro Modules](https://nitro.margelo.com/). +> **v3.0 Native Requirement:** This release requires `react-native-nitro-modules >=0.35.0 <0.36.0`. See [RELEASE_NOTES_v3.0.0.md](./RELEASE_NOTES_v3.0.0.md) for migration steps. + > **v2.0 Breaking Changes:** `parse()` and getter functions now use local time for date-only strings (previously UTC). See [RELEASE_NOTES_v2.0.0.md](./RELEASE_NOTES_v2.0.0.md) for migration guide. ## Features @@ -18,6 +20,7 @@ High-performance native date library for React Native, powered by C++ and [Nitro ## Requirements - React Native 0.76+ (New Architecture required) +- Nitro Modules 0.35.x - iOS 13.0+ - Android SDK 24+ diff --git a/packages/native-date/RELEASE_NOTES_v3.0.0.md b/packages/native-date/RELEASE_NOTES_v3.0.0.md new file mode 100644 index 0000000..5d3db8f --- /dev/null +++ b/packages/native-date/RELEASE_NOTES_v3.0.0.md @@ -0,0 +1,75 @@ +# Release Notes v3.0.0 + +## Highlights + +This release upgrades the native Nitro integration to the Nitro Modules 0.35 line while keeping the JavaScript date API unchanged from v2.x. + +The package now builds and publishes with: + +- `react-native-nitro-modules` 0.35.7 for development and example validation +- `nitrogen` 0.35.7 for generated native specs +- `react-native-nitro-modules >=0.35.0 <0.36.0` as the public peer dependency + +## Breaking Changes + +### Nitro Modules 0.35.x Is Required + +Consumers must install a Nitro Modules 0.35 release. Older Nitro Modules 0.31.x apps are no longer compatible with this package version. + +```bash +npm install @bernagl/react-native-date@3.0.0 react-native-nitro-modules@0.35.7 +# or +yarn add @bernagl/react-native-date@3.0.0 react-native-nitro-modules@0.35.7 +``` + +## Migration Guide + +1. Upgrade the packages: + + ```bash + npm install @bernagl/react-native-date@3.0.0 react-native-nitro-modules@0.35.7 + # or + yarn add @bernagl/react-native-date@3.0.0 react-native-nitro-modules@0.35.7 + ``` + +2. Reinstall iOS pods: + + ```bash + cd ios + pod install + ``` + +3. Rebuild the native app: + + ```bash + npx react-native run-ios + npx react-native run-android + ``` + +4. For Expo Dev Client apps, prebuild before running: + + ```bash + npx expo prebuild --clean + npx expo run:ios + npx expo run:android + ``` + +Expo Go is not supported because this package includes native code. + +## Compatibility Notes + +- No JavaScript date API changes were introduced in v3.0.0. +- Existing v2.x parsing, formatting, timezone, locale, chain, and async APIs remain unchanged. +- The version bump is major because the native Nitro peer dependency changed. +- The peer range intentionally stops before Nitro Modules 0.36 until that line is validated. + +## Validation + +Release validation included: + +- TypeScript check for `@bernagl/react-native-date` +- Jest suite: 923 tests passing +- iOS example build on simulator +- iOS in-app native tests: 194/194 passing +- Android example debug build on emulator +- Android in-app native tests: 194/194 passing diff --git a/packages/native-date/package.json b/packages/native-date/package.json index 91239c5..f93f9ef 100644 --- a/packages/native-date/package.json +++ b/packages/native-date/package.json @@ -1,6 +1,6 @@ { "name": "@bernagl/react-native-date", - "version": "2.0.0", + "version": "3.0.0", "description": "The fastest date library for React Native. Powered by C++ and Nitro Modules.", "sideEffects": false, "main": "./lib/module/index.js", @@ -26,6 +26,8 @@ "cpp", "nitrogen", "nitro.json", + "CHANGELOG.md", + "RELEASE_NOTES_*.md", "*.podspec", "react-native.config.js", "!ios/build",