Skip to Content
0

The given date instance isn't valid

Jan 03 at 02:43 AM

295

avatar image
Former Member

my view code:

<ObjectAttribute

title="{i18n>dateTitle}"

text="{

path: 'invoice>ShippedDate',

type: 'sap.ui.model.type.Date',

formatOptions: {

style: 'long',

source: { pattern: 'yyyy-MM-ddTHH:mm:ss' } } }"/>

ShipppedDate information:

<d:ShippedDate m:type="Edm.DateTime">1997-10-13T00:00:00</d:ShippedDate>

when i run my project , the erroe occured,the error information is :The given date instance isn't valid

please give me a hand,thank you!

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

avatar image
Former Member Jan 05 at 03:47 AM
0

Hi Alila,

May be you can try with this formatoptions:

{source:{pattern:"timestamp"}, pattern:"yyyy-MM-dd"}
Share
10 |10000 characters needed characters left characters exceeded
Iftah Peretz
Jan 03 at 04:31 PM
0

Hi,

As I can only see part of the code, can you tell me if the problem persists if you replace ObjectAttribute with this

<ObjectAttribute title="Test title" text="{ path: 'invoice>ShippedDate' }"/>

The clear point is to narrow it down to the place where the problem arises.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 05 at 02:15 AM
0

thanks your answer, using one row code just as yours , the app run well, can show the date information, but the date format is not my need, we need the pattern like

pattern: 'yyyy-MM-ddTHH:mm:ss'

the following code occured the error:

<mvc:View
	controllerName="sap.ui.demo.wt.controller.Detail"
	xmlns="sap.m"
	xmlns:mvc="sap.ui.core.mvc"
	xmlns:wt="sap.ui.demo.wt.control">
	<Page
		title="{i18n>detailPageTitle}"
		showNavButton="true"
		navButtonPress="onNavBack">
		<ObjectHeader
			responsive="true"
			fullScreenOptimized="true"
			number="{
				parts: [{path: 'invoice>ExtendedPrice'}, {path: 'view>/currency'}],
				type: 'sap.ui.model.type.Currency',
				formatOptions: {
					showMeasure: false
				}
			}"
			numberUnit="{view>/currency}"
			intro="{invoice>ShipperName}"
			title="{invoice>ProductName}">
			<attributes>
				<ObjectAttribute title="{i18n>quantityTitle}" text="{invoice>Quantity}"></ObjectAttribute>
				<ObjectAttribute title="{i18n>dateTitle}" text="{
					path: 'invoice>ShippedDate',
					type: 'sap.ui.model.type.Date',
					formatOptions: {
					  style: 'long',
					  source: {
						pattern: 'yyyy-MM-ddTHH:mm:ss'
					  }
					}
				  }"/>
			</attributes>
		</ObjectHeader>
		<wt:ProductRating class="sapUiSmallMarginBeginEnd" change="onRatingChange"/>
	</Page>
</mvc:View>

Please give me hand.

Share
10 |10000 characters needed characters left characters exceeded
avatar image
Former Member Jan 05 at 02:23 AM
0
Share
10 |10000 characters needed characters left characters exceeded