# LocalDate

<div class="jsdoc-content"><header>
    
        <h2><span class="attribs"><span class="type-signature"></span></span>
            <span class="ancestors"><a href="index.html">types</a>~</span>LocalDate<span class="signature">(yearOrDaysSinceEpoch, month, day)</span><span class="type-signature"></span></h2>
        
            <div class="class-description"><p>A date without a time-zone in the ISO-8601 calendar system, such as 2010-08-05.</p>
<p>LocalDate is an immutable object that represents a date, often viewed as year-month-day. For example, the value &quot;1st October 2014&quot; can be stored in a LocalDate.</p>
<p>This class does not store or represent a time or time-zone. Instead, it is a description of the date, as used for birthdays.
It cannot represent an instant on the time-line without additional information such as an offset or time-zone.</p>
<p>Note that this type can represent dates in the range [-5877641-06-23; 5881580-07-17]
while the ES5 date type can only represent values in the range of [-271821-04-20; 275760-09-13].
In the event that year, month, day parameters do not fall within the ES5 date range an Error will be thrown.
If you wish to represent a date outside of this range, pass a single
parameter indicating the days since epoch. For example, -1 represents 1969-12-31.</p></div>
        
    
</header>


    
        

    
    </div>

## Constructor

<div class="jsdoc-content">
    

    
    <h4 class="name" id="LocalDate"><span class="type-signature"></span>new LocalDate<span class="signature">(yearOrDaysSinceEpoch, month, day)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>yearOrDaysSinceEpoch</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>The year or days since epoch. If days since epoch, month and day should not be provided.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>month</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>Between 1 and 12 inclusive.</p></td>
        </tr>

    

        <tr>
            
                <td class="name"><code>day</code></td>
            

            <td class="type">
            
                
<span class="param-type">Number</span>


            
            </td>

            

            

            <td class="description last"><p>Between 1 and the number of days in the given month of the given year.</p></td>
        </tr>

    
    </tbody>
</table>






    <h5 class="subsection-title">Properties:</h5>

    

<table class="props docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            

            

            <td class="description last"><p>The date representation if falls within a range of an ES5 data type, otherwise an invalid date.</p></td>
        </tr>

    
    </tbody>
</table>




<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L37" target="_blank" rel="noopener">types/local-date.js, line 37</a></p></div>




















    
    

    

    

    

    

    

    

    
        </div>

## Members

<div class="jsdoc-content">

        
            
<h4 class="name" id="_value"><span class="type-signature">(readonly) </span>_value<span class="type-signature"> :Number</span></h4>




<div class="description">
    <p>If date cannot be represented yet given a valid days since epoch, track it internally.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L189" target="_blank" rel="noopener">types/local-date.js, line 189</a></p></div>
<div class="admonition warning"><p class="admonition-title">Deprecated</p><p>This member is in Datastax documentation, but it seems to not be exposed in the API.
Additionally we added a new class member: \`value\` that always returns days since epoch regardless of the date.</p></div>






        
            
<h4 class="name" id="date"><span class="type-signature">(readonly) </span>date<span class="type-signature"> :Date</span></h4>




<div class="description">
    <p>Date object represent this date.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Date</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L174" target="_blank" rel="noopener">types/local-date.js, line 174</a></p></div>






        
            
<h4 class="name" id="day"><span class="type-signature">(readonly) </span>day<span class="type-signature"> :Number</span></h4>




<div class="description">
    <p>A number between 1 and the number of days in the given month of the given year (value up to 31).
May return NaN if cannot be represented as a Date.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L161" target="_blank" rel="noopener">types/local-date.js, line 161</a></p></div>






        
            
<h4 class="name" id="month"><span class="type-signature">(readonly) </span>month<span class="type-signature"> :Number</span></h4>




<div class="description">
    <p>A number between 1 and 12 inclusive representing the month.
May return NaN if cannot be represented as a Date.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L147" target="_blank" rel="noopener">types/local-date.js, line 147</a></p></div>






        
            
<h4 class="name" id="value"><span class="type-signature">(readonly) </span>value<span class="type-signature"> :Number</span></h4>




<div class="description">
    <p>Always valid amount of days since epoch.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L202" target="_blank" rel="noopener">types/local-date.js, line 202</a></p></div>






        
            
<h4 class="name" id="year"><span class="type-signature">(readonly) </span>year<span class="type-signature"> :Number</span></h4>




<div class="description">
    <p>A number representing the year. May return NaN if cannot be represented as a Date.</p>
</div>



    <h5>Type:</h5>
    <ul>
        <li>
            
<span class="param-type">Number</span>


        </li>
    </ul>





<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L133" target="_blank" rel="noopener">types/local-date.js, line 133</a></p></div>






        
    

    
        </div>

## Methods

<div class="jsdoc-content">

        
            

    

    
    <h4 class="name" id="compare"><span class="type-signature"></span>compare<span class="signature">(other)</span><span class="type-signature"> &rarr; {number}</span></h4>
    

    



<div class="description">
    <p>Compares this LocalDate with the given one.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>other</code></td>
            

            <td class="type">
            
                
<span class="param-type">LocalDate</span>


            
            </td>

            

            

            <td class="description last"><p>date to compare against.</p></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L283" target="_blank" rel="noopener">types/local-date.js, line 283</a></p></div>















<h5>Returns:</h5>

        
<div class="param-desc">
    <p>0 if they are the same, 1 if the this is greater, and -1
if the given one is greater.</p>
</div>



<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">number</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="equals"><span class="type-signature"></span>equals<span class="signature">(other)</span><span class="type-signature"> &rarr; {Boolean}</span></h4>
    

    



<div class="description">
    <p>Returns true if the value of the LocalDate instance and other are the same</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>other</code></td>
            

            <td class="type">
            
                
<span class="param-type">LocalDate</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L305" target="_blank" rel="noopener">types/local-date.js, line 305</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Boolean</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="toBuffer"><span class="type-signature"></span>toBuffer<span class="signature">()</span><span class="type-signature"> &rarr; {Buffer}</span></h4>
    

    



<div class="description">
    <p>Gets the bytes representation of the instance.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L317" target="_blank" rel="noopener">types/local-date.js, line 317</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">Buffer</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="toJSON"><span class="type-signature"></span>toJSON<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
    

    



<div class="description">
    <p>Gets the string representation of the instance in the form: yyyy-mm-dd, valid for JSON.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L356" target="_blank" rel="noopener">types/local-date.js, line 356</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id="toString"><span class="type-signature"></span>toString<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4>
    

    



<div class="description">
    <p>Gets the string representation of the instance in the form: yyyy-mm-dd if
the value can be parsed as a Date, otherwise days since epoch.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L333" target="_blank" rel="noopener">types/local-date.js, line 333</a></p></div>















<h5>Returns:</h5>

        


<dl>
    <dt>
        Type
    </dt>
    <dd>
        
<span class="param-type">String</span>


    </dd>
</dl>

    





        
            

    

    
    <h4 class="name" id=".fromBuffer"><span class="type-signature">(static) </span>fromBuffer<span class="signature">(buffer)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate using the bytes representation.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>buffer</code></td>
            

            <td class="type">
            
                
<span class="param-type">Buffer</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L272" target="_blank" rel="noopener">types/local-date.js, line 272</a></p></div>




















        
            

    

    
    <h4 class="name" id=".fromDate"><span class="type-signature">(static) </span>fromDate<span class="signature">(date)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate using the year, month and day from the provided local date time.</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>date</code></td>
            

            <td class="type">
            
                
<span class="param-type">Date</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L230" target="_blank" rel="noopener">types/local-date.js, line 230</a></p></div>




















        
            

    

    
    <h4 class="name" id=".fromString"><span class="type-signature">(static) </span>fromString<span class="signature">(value)</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate using the year, month and day provided in the form: yyyy-mm-dd or
days since epoch (i.e. -1 for Dec 31, 1969).</p>
</div>









    <h5>Parameters:</h5>
    

<table class="params docutils align-default">
    <thead>
    <tr>
        
        <th>Name</th>
        

        <th>Type</th>

        

        

        <th class="last">Description</th>
    </tr>
    </thead>

    <tbody>
    

        <tr>
            
                <td class="name"><code>value</code></td>
            

            <td class="type">
            
                
<span class="param-type">String</span>


            
            </td>

            

            

            <td class="description last"></td>
        </tr>

    
    </tbody>
</table>






<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L246" target="_blank" rel="noopener">types/local-date.js, line 246</a></p></div>




















        
            

    

    
    <h4 class="name" id=".now"><span class="type-signature">(static) </span>now<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate using the current year, month and day from the system clock in the default time-zone.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L215" target="_blank" rel="noopener">types/local-date.js, line 215</a></p></div>




















        
            

    

    
    <h4 class="name" id=".utcNow"><span class="type-signature">(static) </span>utcNow<span class="signature">()</span><span class="type-signature"></span></h4>
    

    



<div class="description">
    <p>Creates a new instance of LocalDate using the current date from the system clock at UTC.</p>
</div>













<div class="admonition note"><p class="admonition-title">Source</p><p><a href="https://github.com/scylladb/nodejs-rs-driver/blob/v0.6.1/lib/types/local-date.js#L222" target="_blank" rel="noopener">types/local-date.js, line 222</a></p></div></div>
