# getcurrentitem()  mthod

**URL:** <https://forum.wixstudio.com/t/getcurrentitem-mthod/16117>\
**Category:** Ask the community\
**Tags:** wix-bookings, question, code\
**Created:** [March 6, 2019, 1:33pm UTC](https://forum.wixstudio.com/t/getcurrentitem-mthod/16117 "2019-03-06T13:33:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![octohima](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/octohima/32/9399_2.png) [@octohima](https://forum.wixstudio.com/u/octohima)\
**Post date:** [March 6, 2019, 1:33pm UTC](https://forum.wixstudio.com/t/getcurrentitem-mthod/16117/1 "2019-03-06T13:33:30Z")

</div>

when i try to get date field from collection in my panel code where this field i’m not connected dirctly to it’s dataset but i connected to it by refernce in anther dataset coolection an error apear. this my code

$w.onReady( ()=\> {  
$w(‘#dataset1’).onReady(()=\>{  
**var** date=$w(‘#dataset1’).getCurrentItem(). _ **barithdate** _ ;  
**var** options = { year: ‘numeric’, month: ‘numeric’, day: ‘numeric’ };  
$w(‘#text27’).text=date.toLocaleDateString(‘ar-EG’, options);

where barithdate field in client collection and i connecte client collection to booking collection by refernce .where booking collection contain refernce field refer to client collection items .in my page i use booking (R&W)dataset onlyin my pag . this error apears

An error occurred in one of datasetReady callbacks TypeError: Cannot read property ‘toLocaleDateString’ of undefined

---

<div class="post-metadata">

**Author:** ![givemeawhisky](https://sea1.discourse-cdn.com/wix/user_avatar/forum.wixstudio.com/givemeawhisky/32/5383_2.png) [@givemeawhisky](https://forum.wixstudio.com/u/givemeawhisky)\
**Post date:** [June 17, 2019, 12:55pm UTC](https://forum.wixstudio.com/t/getcurrentitem-mthod/16117/2 "2019-06-17T12:55:45Z")

</div>

When working with JavaScript you will sooner rather than later get a TypeError: Cannot read property ‘name’ of undefined (or TypeError: something.name is undefined or similar). This happens when you try to access a property of a value that is _undefined_ (or similarly for values that are _null_ ).  
(The undefined property indicates that a variable has not been assigned a value, or not declared at all.)
