ionic-team / ionic-team/capacitor
[Bug]: `shouldStringifyDatesInCalls` should apply to both directions
- Dominant language
- TypeScript
- Stars
- 16.7k
- Forks
- 1.3k
- Avg merge
- 3d 15h
- Merged PRs (30d)
- 10
Description
### Capacitor Version
💊 Capacitor Doctor 💊
Latest Dependencies:
@capacitor/cli: 5.7.0
@capacitor/core: 5.7.0
@capacitor/android: 5.7.0
@capacitor/ios: 5.7.0
Installed Dependencies:
@capacitor/cli: 5.4.2
@capacitor/android: 5.4.2
@capacitor/core: 5.4.2
@capacitor/ios: 5.4.2
[success] iOS looking great! 👌
[success] Android looking great! 👌
### Other API Details
_No response_
### Platforms Affected
- [X] iOS
- [ ] Android
- [ ] Web
### Current Behavior
The [Capacitor Firebase Firestore](https://capawesome.io/plugins/firebase/cloud-firestore/) plugin must be able to distinguish between strings and date objects both incoming and outgoing.
I use [`shouldStringifyDatesInCalls`](https://capacitorjs.com/docs/core-apis/data-types#dates) to prevent JS date objects from being converted to strings. Unfortunately, this only works incoming, not outgoing.
### Expected Behavior
If I return a Date object on Android (see https://github.com/ionic-team/capacitor/issues/7252) or iOS and the [`shouldStringifyDatesInCalls`](https://capacitorjs.com/docs/core-apis/data-types#dates) is set to `false`, then I expect a JS date object at JS level.
### Project Reproduction
https://github.com/robingenz/capacitor-firebase-plugin-demo
### Additional Information
See https://github.com/robingenz/capacitor-firebase-plugin-demo/blob/676a3ea77190011b1951f7e9e983156467cf9a77/src/app/modules/firebase-firestore/firebase-firestore.page.ts
Contributor guide
Assessment
This issue has not been assessed yet.