Beaver-pocket icon indicating copy to clipboard operation
Beaver-pocket copied to clipboard

Import creates ISO `createdAt` and `updatedAt` strings instead of unix timestamps

Open func0der opened this issue 1 year ago • 3 comments

Describe the bug Import creates ISO createdAt and updatedAt strings instead of unix timestamps

To Reproduce Steps to reproduce the behavior:

  1. Get your hands on a working data.json (had mine exported from desktop)
  2. Reset the app by deleting current data.json (probably easiest, but the bug is easier to spot that way)
  3. Press the Import button on the welcome page
  4. Inspect the created data.json and see strings in createdAt and updatedAt

Expected behavior Unix timestamps in createdAt and updatedAt

Screenshots not applicable

Smartphone (please complete the following information):

  • Device: Android
  • OS: Android
  • Browser -
  • Version 1.0.1

Additional context Setting the date on the notes: https://github.com/Beaver-Notes/Beaver-pocket/blob/af706d50b95c02a72ab232024e3759e56dad7297/src/Welcome.tsx#L219

Saving the notes to data.json manually: https://github.com/Beaver-Notes/Beaver-pocket/blob/af706d50b95c02a72ab232024e3759e56dad7297/src/Welcome.tsx#L217

I think it would be a good idea to call https://github.com/Beaver-Notes/Beaver-pocket/blob/af706d50b95c02a72ab232024e3759e56dad7297/src/store/notes.ts#L72 for each note instead, because it handles conversion of timestamps already.

The issue is probably EVERYWHERE where an import is located. Found similar code here: https://github.com/Beaver-Notes/Beaver-pocket/blob/af706d50b95c02a72ab232024e3759e56dad7297/src/settings/about.tsx#L431

I suggest pulling import and export code together, maybe even over both the repos to be reused where possible and avoid any regressions between desktop and mobile version and/or on the versions itselfs.

Thought this was data structure error and opened up this issues over at desktop: https://github.com/Beaver-Notes/Beaver-Notes/issues/227

func0der avatar Aug 05 '24 17:08 func0der

Thanks for opening the issue. Beaver Pocket is still under development, and the feature you are referring to is no longer available because Beaver Pocket now only uses cloud sync (WebDAV and Dropbox; we are also working on integrating other cloud services) due to limitations on mobile platforms. That being said, I'll look into the code in the development branch and see if this issue has been addressed there.

Daniele-rolli avatar Aug 05 '24 18:08 Daniele-rolli

Understandable step for iOS that is. For Android there are workarounds, which too are not really user friendly though. If you could still keep functionality of working with imports/exports and working local only in there, it would greatly appreciated. I dunno if people are comfortable with sharing their cloud credentials or tokens with a third party app.

Unfortunately I can not search the development branch from the web interface, so I can not verify if the bug is still there from where I am. I clicked through and found a lot of code duplication regarding translations and so on in almost every TSX file, which mention import and export (importSuccess: "home.importSuccess",). Probably not what you want :)

Anyhow. Thanks for the quick response. Guess I have to work around this by manually editing the json for now. Or I only use one device.

Offtopic: Thanks for a giving creating another note taking app a shot. It really is hard to get one that does what one needs.

func0der avatar Aug 05 '24 18:08 func0der

The manual import and export functions are still present in the development branch, and we'll probably keep them. It's not very user-friendly, but it's available. The only issue I have is that the app's folder doesn't seem accessible on Android, while it appears to be accessible on iOS.

Regarding credentials, we use Capacitor Secure Storage, which stores credentials in the keychain on iOS and in AndroidKeyStore and SharedPreferences on Android. We only use tokens where possible, such as with Dropbox, and the app can only write to its own folders.

I'll check for the bug myself.

Thanks again for the feedback. I'm happy you're enjoying what we do.

Daniele-rolli avatar Aug 05 '24 19:08 Daniele-rolli