我有類似的問題,例如here或here。我也在使用XML視圖。有了這個代碼SAPUI5:格式化日期字段(Odata)
<Text text="{ path: 'model1>CHANGE_DATE' }" />
我得到follwowing輸出:
/Date(1671944676355)/
當我嘗試
<Text text="{ path: 'model1>CHANGE_DATE',
type: 'sap.ui.model.type.Date',
formatOptions: { pattern: 'MM/dd/yyyy' } }" />,
我收到錯誤消息
sap-ui-core-dbg.js:30928 Uncaught TypeError: oDate.getTime is not a function
你有任何愛迪爲什麼格式不起作用?
在此先感謝。
問候
丹
這是一個ODataModel嗎?該字段是否被聲明爲Edm.DateTime? – cschuff
好的。我正在使用JsonModel。也許這就是原因。如有必要,我可以嘗試轉換爲OdataModel。 –
猜猜這是原因。您也可以切換到另一種日期格式或使用格式化函數將字符串轉換爲JS Date對象 – cschuff