Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Bug Report: Error Creating Document with Datetime attribute #66

Closed
2 tasks done
destocot opened this issue Dec 21, 2023 · 4 comments
Closed
2 tasks done

🐛 Bug Report: Error Creating Document with Datetime attribute #66

destocot opened this issue Dec 21, 2023 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@destocot
Copy link

destocot commented Dec 21, 2023

👟 Reproduction steps

 const document = await databases.createDocument(
    import.meta.env.VITE_APPWRITE_EVENTS_DATABASE_ID,
    import.meta.env.VITE_APPWRITE_EVENTS_COLLECTION_ID,
    ID.unique(),
    {
    ...,
    date: new Date().toISOString(),
    ...
    }
  );

My Solution: If I remove the Z at end of datetime, document is then correctly created

 const document = await databases.createDocument(
    import.meta.env.VITE_APPWRITE_EVENTS_DATABASE_ID,
    import.meta.env.VITE_APPWRITE_EVENTS_COLLECTION_ID,
    ID.unique(),
    {
    ...,
    date: new Date(target.date.value).toISOString().slice(0, -1),
    ...
    }
  );


👍 Expected behavior

New document in collection will be created.

👎 Actual Behavior

Gives a 500 server error

image

🎲 Appwrite version

Version 0.10.x

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

@destocot destocot added the bug Something isn't working label Dec 21, 2023
@stnguyen90
Copy link
Contributor

stnguyen90 commented Dec 22, 2023

@destocot, thanks for creating this issue! 🙏 Were you using the web sdk or node SDK?

Also, what version of the SDK?

@stnguyen90 stnguyen90 self-assigned this Dec 22, 2023
@destocot
Copy link
Author

destocot commented Dec 22, 2023

@stnguyen90
apologies for any confusion but it was the

web sdk | "appwrite": "^13.0.1",

@stnguyen90
Copy link
Contributor

@destocot, sorry for the delay. I just tested with version 13.0.1 of the SDK with code like:

      let promise = databases.createDocument('default', 'test', 'unique()', {
          'dt': new Date().toISOString(),
          'searchAttribute': 'a new task',
      });

and this worked fine for me:
image
image
image

What's the payload tab look like for you in your browser's dev tools?

@ChiragAgg5k
Copy link
Member

Marking the issue as closed due to inactivity, feel free to re-open if the issue persists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants