Issue
I have a Angular V13.0.2 app that I am expanding. I just recently added Dexie (indexedDB). Now when I try to add a date to my database I only get a "Invalid Date" statement out of it.
// Export clients
export interface Clients {
    id?: number;
    addressId: number;
    firstName: string;
    lastName: string;
    created: Date;
}
// Create a client
const clientId = await db.clients.add({
   addressId: addressId,
   firstName: 'John',
   lastName: 'Doe',
   created: new Date('1995-12-17T03:24:00')
});
The visualization is nothing more then a ngFor over the clients. Am I missing something?
Solution
It was not very clear. But Dexie.js uses the UNIX epoch time format. For anyone with the same issue, use:
new Date('1995-12-17T03:24:00')
I hope someone somewhere might find this useful.
Answered By - Ric Bocad
 
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.