You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constoriginalCreatedAt=newDate('2024-01-01T00:00:00.000Z')const[modelMessage]=uiMessageToModelMessages({id: 'message-1',role: 'user',createdAt: originalCreatedAt,parts: [{type: 'text',content: 'Hello'}],})// ModelMessage has no createdAt field todayexpect('createdAt'inmodelMessage).toBe(false)const[uiMessage]=modelMessagesToUIMessages([modelMessage])expect(uiMessage.createdAt).toBeUndefined()constnormalized=normalizeToUIMessage(modelMessage,()=>'message-1')// Fresh stamp — not the original wall-clock timeexpect(normalized.createdAt).not.toEqual(originalCreatedAt)
Expected behavior
Add an optional createdAt on ModelMessage Then:
One-to-one UI → model conversion copies UIMessage.createdAt onto the ModelMessage.
Model → UI conversion restores it onto UIMessage.createdAt.
normalizeToUIMessage() prefers a persisted createdAt and only falls back to new Date() when absent.
Terms & Code of Conduct
I agree to follow this project's Code of Conduct
I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.
I’m preparing a focused PR for this issue. The change will preserve the optional createdAt timestamp through UIMessage/ModelMessage conversion and add regression coverage without requiring a model or API key.
Activity
mikemikimike commentedon Aug 10, 2026
I’m preparing a focused PR for this issue. The change will preserve the optional createdAt timestamp through UIMessage/ModelMessage conversion and add regression coverage without requiring a model or API key.