Skip to Content
avatar image
Former Member

The given date instance isn't valid

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!

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

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

    Hi Alila,

    May be you can try with this formatoptions:

    {source:{pattern:"timestamp"}, pattern:"yyyy-MM-dd"}
    Add comment
    10|10000 characters needed characters exceeded

  • Jan 03 at 04:31 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05 at 02:15 AM

    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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jan 05 at 02:23 AM
    Add comment
    10|10000 characters needed characters exceeded