So i wanted to give AWS Amplify a try, as the new project I am starting will start our simple but will grow to be more complex and I dont want to go the Firebase route for that reason. So I setup Auth and created my Data Models and added the Amplify Lib to my angular front end. I can login and read my data. So far so good.
Now I wanted to do a basic query on my data. Filtering based on a basic string field is easy for things like the Name:
const members = await DataStore.query(Member, m => m.firstName("eq", "Steve"));
What I can't seem to find is any documentation on how you would query things like dates?
I have a model called Event, and there is how you'd do a typical create for an event (note the fields StartTimestamp
, and EndTimestamp
):
await DataStore.save(
new Event({
"Title": "Lorem ipsum dolor sit amet",
"StartTimestamp": "1970-01-01T12:30:23.999ZM",
"EndTimestamp": "1970-01-01T12:30:23.999ZM",
"Notes": "Lorem ipsum dolor sit amet"
})
);
Both StartTimestamp
, and EndTimestamp
are of type AWSDateTime
:
When pulling the data for events I see the type in JS as I read them is string. So how do I query the dates then? string comparison wont help. I know the underlying DB for AWS Amplify is GraphQL and querying a date there is easy but I am still limited to what the Amplify DataStore Lib gives me to work with.
Any advice would be greatly appreciated.