UNPKG

fluro

Version:

Promise based HTTP Fluro client for the browser and node.js

2,425 lines (643 loc) 36.4 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>date - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="access.html">access</a><ul class='methods'><li data-type='method'><a href="access.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="access.html#.can">can</a></li><li data-type='method'><a href="access.html#.canDeleteItem">canDeleteItem</a></li><li data-type='method'><a href="access.html#.canEditItem">canEditItem</a></li><li data-type='method'><a href="access.html#.canKnowOf">canKnowOf</a></li><li data-type='method'><a href="access.html#.canViewItem">canViewItem</a></li><li data-type='method'><a href="access.html#.has">has</a></li><li data-type='method'><a href="access.html#.isAuthor">isAuthor</a></li><li data-type='method'><a href="access.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="access.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="access.html#.retrieveActionableRealms">retrieveActionableRealms</a></li><li data-type='method'><a href="access.html#.retrieveCurrentSession">retrieveCurrentSession</a></li><li data-type='method'><a href="access.html#.setDefaultApplication">setDefaultApplication</a></li></ul></li><li><a href="api.html">api</a><ul class='methods'><li data-type='method'><a href="api.html#.delete">delete</a></li><li data-type='method'><a href="api.html#.generateEndpointURL">generateEndpointURL</a></li><li data-type='method'><a href="api.html#.get">get</a></li><li data-type='method'><a href="api.html#.post">post</a></li><li data-type='method'><a href="api.html#.put">put</a></li></ul></li><li><a href="app.device.html">device</a></li><li><a href="asset.html">asset</a><ul class='methods'><li data-type='method'><a href="asset.html#.avatarUrl">avatarUrl</a></li><li data-type='method'><a href="asset.html#.downloadUrl">downloadUrl</a></li><li data-type='method'><a href="asset.html#.filesize">filesize</a></li><li data-type='method'><a href="asset.html#.getUrl">getUrl</a></li><li data-type='method'><a href="asset.html#.imageUrl">imageUrl</a></li><li data-type='method'><a href="asset.html#.playerUrl">playerUrl</a></li><li data-type='method'><a href="asset.html#.posterUrl">posterUrl</a></li><li data-type='method'><a href="asset.html#.typeFromMime">typeFromMime</a></li></ul></li><li><a href="auth.html">auth</a><ul class='methods'><li data-type='method'><a href="auth.html#.addEventListener">addEventListener</a></li><li data-type='method'><a href="auth.html#.changeAccount">changeAccount</a></li><li data-type='method'><a href="auth.html#.getCurrentToken">getCurrentToken</a></li><li data-type='method'><a href="auth.html#.getCurrentUser">getCurrentUser</a></li><li data-type='method'><a href="auth.html#.impersonate">impersonate</a></li><li data-type='method'><a href="auth.html#.login">login</a></li><li data-type='method'><a href="auth.html#.logout">logout</a></li><li data-type='method'><a href="auth.html#.refreshAccessToken">refreshAccessToken</a></li><li data-type='method'><a href="auth.html#.removeAllListeners">removeAllListeners</a></li><li data-type='method'><a href="auth.html#.removeEventListener">removeEventListener</a></li><li data-type='method'><a href="auth.html#.retrieveUserFromResetToken">retrieveUserFromResetToken</a></li><li data-type='method'><a href="auth.html#.sendResetPasswordRequest">sendResetPasswordRequest</a></li><li data-type='method'><a href="auth.html#.set">set</a></li><li data-type='method'><a href="auth.html#.signup">signup</a></li><li data-type='method'><a href="auth.html#.updateUserWithToken">updateUserWithToken</a></li></ul></li><li><a href="cache.html">cache</a><ul class='methods'><li data-type='method'><a href="cache.html#.get">get</a></li><li data-type='method'><a href="cache.html#.reset">reset</a></li></ul></li><li><a href="components.html">components</a><ul class='methods'><li data-type='method'><a href="components.html#.hydrateModel">hydrateModel</a></li></ul></li><li><a href="content.html">content</a><ul class='methods'><li data-type='method'><a href="content.html#.duplicate">duplicate</a></li><li data-type='method'><a href="content.html#.external">external</a></li><li data-type='method'><a href="content.html#.filter">filter</a></li><li data-type='method'><a href="content.html#.form">form</a></li><li data-type='method'><a href="content.html#.get">get</a></li><li data-type='method'><a href="content.html#.getMultiple">getMultiple</a></li><li data-type='method'><a href="content.html#.keys">keys</a></li><li data-type='method'><a href="content.html#.list">list</a></li><li data-type='method'><a href="content.html#.query">query</a></li><li data-type='method'><a href="content.html#.related">related</a></li><li data-type='method'><a href="content.html#.retrieve">retrieve</a></li><li data-type='method'><a href="content.html#.slug">slug</a></li><li data-type='method'><a href="content.html#.submitInteraction">submitInteraction</a></li><li data-type='method'><a href="content.html#.submitPost">submitPost</a></li><li data-type='method'><a href="content.html#.thread">thread</a></li><li data-type='method'><a href="content.html#.values">values</a></li></ul></li><li><a href="date.html">date</a><ul class='methods'><li data-type='method'><a href="date.html#.countdown">countdown</a></li><li data-type='method'><a href="date.html#.dateFromID">dateFromID</a></li><li data-type='method'><a href="date.html#.formatDate">formatDate</a></li><li data-type='method'><a href="date.html#.getAge">getAge</a></li><li data-type='method'><a href="date.html#.groupEventByDate">groupEventByDate</a></li><li data-type='method'><a href="date.html#.isDifferentTimezoneThanUser">isDifferentTimezoneThanUser</a></li><li data-type='method'><a href="date.html#.isMultiDayEvent">isMultiDayEvent</a></li><li data-type='method'><a href="date.html#.localDate">localDate</a></li><li data-type='method'><a href="date.html#.militaryTimestamp">militaryTimestamp</a></li><li data-type='method'><a href="date.html#.readableEventDate">readableEventDate</a></li><li data-type='method'><a href="date.html#.readableEventTime">readableEventTime</a></li><li data-type='method'><a href="date.html#.timeago">timeago</a></li><li data-type='method'><a href="date.html#.timeline">timeline</a></li><li data-type='method'><a href="date.html#.timestampToAmPm">timestampToAmPm</a></li><li data-type='method'><a href="date.html#.timezones">timezones</a></li></ul></li><li><a href="fluro.html">fluro</a></li><li><a href="types.html">types</a><ul class='methods'><li data-type='method'><a href="types.html#.all">all</a></li><li data-type='method'><a href="types.html#.basicTypes">basicTypes</a></li><li data-type='method'><a href="types.html#.get">get</a></li><li data-type='method'><a href="types.html#.mapDefinitionItems">mapDefinitionItems</a></li><li data-type='method'><a href="types.html#.parentType">parentType</a></li><li data-type='method'><a href="types.html#.postableTypes">postableTypes</a></li><li data-type='method'><a href="types.html#.readable">readable</a></li><li data-type='method'><a href="types.html#.reloadTerminology">reloadTerminology</a></li><li data-type='method'><a href="types.html#.retrieve">retrieve</a></li><li data-type='method'><a href="types.html#.subTypes">subTypes</a></li><li data-type='method'><a href="types.html#.term">term</a></li></ul></li><li><a href="utils.html">utils</a><ul class='methods'><li data-type='method'><a href="utils.html#.arrayIDs">arrayIDs</a></li><li data-type='method'><a href="utils.html#.comma">comma</a></li><li data-type='method'><a href="utils.html#.currencySymbol">currencySymbol</a></li><li data-type='method'><a href="utils.html#.errorMessage">errorMessage</a></li><li data-type='method'><a href="utils.html#.extractFromArray">extractFromArray</a></li><li data-type='method'><a href="utils.html#.formatCurrency">formatCurrency</a></li><li data-type='method'><a href="utils.html#.getDefaultValueForField">getDefaultValueForField</a></li><li data-type='method'><a href="utils.html#.getFlattenedFields">getFlattenedFields</a></li><li data-type='method'><a href="utils.html#.getStringID">getStringID</a></li><li data-type='method'><a href="utils.html#.guid">guid</a></li><li data-type='method'><a href="utils.html#.hash">hash</a></li><li data-type='method'><a href="utils.html#.injectScript">injectScript</a></li><li data-type='method'><a href="utils.html#.machineName">machineName</a></li><li data-type='method'><a href="utils.html#.mapParameters">mapParameters</a></li><li data-type='method'><a href="utils.html#.matchInArray">matchInArray</a></li><li data-type='method'><a href="utils.html#.processCardPrioritySort">processCardPrioritySort</a></li></ul></li><li><a href="video.html">video</a><ul class='methods'><li data-type='method'><a href="video.html#.hhmmss">hhmmss</a></li><li data-type='method'><a href="video.html#.readableMilliseconds">readableMilliseconds</a></li><li data-type='method'><a href="video.html#.readableSeconds">readableSeconds</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">date</h1> <section> <header> <h2> date </h2> <div class="class-description">A static service that provides useful functions for working with dates and timestamps.</div> </header> <article> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".countdown"><span class="type-signature">(static) </span>countdown<span class="signature">(date)</span><span class="type-signature"> &rarr; {Object}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line777">line 777</a> </li></ul></dd> </dl> <div class="description"> A helper function that can return the pieces for a countdown clock relative to a specified date </div> <h5>Parameters:</h5> <table class="params"> <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">The date we are counting down to</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> An object with days, minutes, hours, seconds, </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".dateFromID"><span class="type-signature">(static) </span>dateFromID<span class="signature">(id, format, timezone)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line309">line 309</a> </li></ul></dd> </dl> <div class="description"> Parses an ObjectID and returns the date of creation </div> <h5>Example</h5> <pre class="prettyprint"><code>var id = '5ca3d64dd2bb085eb9d450db' return dateFromID.formatDate(id, 'D M YYYY')</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>id</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The id of the object to parse</td> </tr> <tr> <td class="name"><code>format</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">A string representing the format to output for formatting syntax see https://momentjs.com/docs/#/displaying/format/</td> </tr> <tr> <td class="name"><code>timezone</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The timezone to use if needing to translate the date to another timezone eg. Australia/Melbourne</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A human readable string </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".formatDate"><span class="type-signature">(static) </span>formatDate<span class="signature">(date, format, timezone)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line267">line 267</a> </li></ul></dd> </dl> <div class="description"> Parses a date and returns a human readable date string </div> <h5>Example</h5> <pre class="prettyprint"><code>var date = new Date() return fluro.date.formatDate(date, 'h:mma DDD MMM YYYY') var dateString = '2019-04-18T23:00:00.000Z' return fluro.date.formatDate(dateString, 'D M YYYY', 'Australia/Melbourne')</code></pre> <h5>Parameters:</h5> <table class="params"> <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> | <span class="param-type">String</span> </td> <td class="description last">The date or string to parse</td> </tr> <tr> <td class="name"><code>format</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">A string representing the format to output for formatting syntax see https://momentjs.com/docs/#/displaying/format/</td> </tr> <tr> <td class="name"><code>timezone</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The timezone to use if needing to translate the date to another timezone eg. Australia/Melbourne</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A human readable string </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".getAge"><span class="type-signature">(static) </span>getAge<span class="signature">()</span><span class="type-signature"> &rarr; {Integer}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line235">line 235</a> </li></ul></dd> </dl> <div class="description"> A helpful function that can quickly get an age from a supplied date string </div> <h5>Example</h5> <pre class="prettyprint"><code>fluro.date.getAge('2019-04-18T23:00:00.000Z')</code></pre> <h5>Returns:</h5> <div class="param-desc"> The age in years </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Integer</span> </dd> </dl> <h4 class="name" id=".groupEventByDate"><span class="type-signature">(static) </span>groupEventByDate<span class="signature">(events)</span><span class="type-signature"> &rarr; {Array}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line599">line 599</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>events</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">The events we want to group</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A grouped array of dates and events </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".isDifferentTimezoneThanUser"><span class="type-signature">(static) </span>isDifferentTimezoneThanUser<span class="signature">()</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line149">line 149</a> </li></ul></dd> </dl> <div class="description"> A function that returns all of the available timezones. Often used to populate a select box </div> <h5>Returns:</h5> <div class="param-desc"> True if the specified timezone is different than the viewing user </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".isMultiDayEvent"><span class="type-signature">(static) </span>isMultiDayEvent<span class="signature">(event)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line327">line 327</a> </li></ul></dd> </dl> <div class="description"> Checks whether an event spans over multiple days </div> <h5>Example</h5> <pre class="prettyprint"><code>return fluro.date.isMultiDayEvent({startDate:...})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>event</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">A Fluro event object with a startDate and an endDate</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> True or False if the event spans multiple days </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".localDate"><span class="type-signature">(static) </span>localDate<span class="signature">(date, specifiedTimezone)</span><span class="type-signature"> &rarr; {Date}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line190">line 190</a> </li></ul></dd> </dl> <div class="description"> A function that will return a date in context of a specified timezone If no timezone is specified then the default timezone of the current clock will be used. This will return dates that are incorrect on purpose. So that it can appear to the user as if they were in another timezone. As Javascript dates are always in the context of the timezone they are being viewed in, this function will give you a date that is technically not the Universal point in time of the date, but rather a time that reads in your timezone as if you were in the specified timezone. </div> <h5>Parameters:</h5> <table class="params"> <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">Either a javascript date object, or a string timestamp representing a javascript date object</td> </tr> <tr> <td class="name"><code>specifiedTimezone</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">The timezone to retrieve the date in eg. Australia/Melbourne</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A javascript date object transformed to match the specified timezone </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Date</span> </dd> </dl> <h4 class="name" id=".militaryTimestamp"><span class="type-signature">(static) </span>militaryTimestamp<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line53">line 53</a> </li></ul></dd> </dl> <div class="description"> A function that converts a timestamp string '7:30' to '0730'; </div> <h5>Returns:</h5> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".readableEventDate"><span class="type-signature">(static) </span>readableEventDate<span class="signature">(event, style)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line390">line 390</a> </li></ul></dd> </dl> <div class="description"> A helper function that can display a human-readable date for an event taking into consideration the context of the current time, the event's start and end time. This is often used as a string filter and what is relevant </div> <h5>Example</h5> <pre class="prettyprint"><code>//Returns 5:30pm 1 May fluro.date.readableEventDate({"startDate": "2019-05-01T07:30:00.000Z", "endDate":"2019-05-01T07:30:00.000Z"}) //Returns 5:30pm - 7:30pm 1 May fluro.date.readableEventDate({"startDate": "2019-05-01T07:30:00.000Z", "endDate":"2019-05-01T09:30:00.000Z"}) //Returns 1 - 5 May 2015 fluro.date.readableEventDate({"startDate": "2015-05-01T07:30:00.000Z", "endDate":"2015-05-05T09:30:00.000Z"}) //1 May - 21 Jun 2019 fluro.date.readableEventDate({"startDate": "2019-05-01T07:30:00.000Z", "endDate":"2019-06-21T09:30:00.000Z"})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>event</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">An object that has both a startDate and endDate property, Usually an event object from the Fluro API</td> </tr> <tr> <td class="name"><code>style</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Whether to return a 'short', 'medium' or 'long' date</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> The human readable date for the event </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".readableEventTime"><span class="type-signature">(static) </span>readableEventTime<span class="signature">(event)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line534">line 534</a> </li></ul></dd> </dl> <div class="description"> A helper function that can display a human-readable time for an event taking into consideration the context of the current time, the event's start and end time. This is often used as a string filter </div> <h5>Example</h5> <pre class="prettyprint"><code>//Returns 5:30pm fluro.date.readableEventTime({"startDate": "2019-05-01T07:30:00.000Z", "endDate":null}) //Returns 5:30pm - 7:30pm fluro.date.readableEventTime({"startDate": "2019-05-01T07:30:00.000Z", "endDate":"2019-05-01T09:30:00.000Z"})</code></pre> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>event</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">An object that has both a startDate and endDate property, Usually an event object from the Fluro API</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> The human readable time for the event </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".timeago"><span class="type-signature">(static) </span>timeago<span class="signature">(date)</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line294">line 294</a> </li></ul></dd> </dl> <div class="description"> Parses a date and returns a 'timeago' string </div> <h5>Example</h5> <pre class="prettyprint"><code>var date = new Date() //Returns 10 mins ago return fluro.date.timeago(date)</code></pre> <h5>Parameters:</h5> <table class="params"> <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> | <span class="param-type">String</span> </td> <td class="description last">The date or string to parse</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A human readable string </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".timeline"><span class="type-signature">(static) </span>timeline<span class="signature">(items)</span><span class="type-signature"> &rarr; {Array}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line655">line 655</a> </li></ul></dd> </dl> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>items</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last">The items we want to group on the timeline</td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="param-desc"> A grouped array of dates </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> <h4 class="name" id=".timestampToAmPm"><span class="type-signature">(static) </span>timestampToAmPm<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line106">line 106</a> </li></ul></dd> </dl> <div class="description"> A function that converts a timestamp string '13:30' to '1:30pm'; </div> <h5>Returns:</h5> <div class="param-desc"> A formatted timestamp string </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".timezones"><span class="type-signature">(static) </span>timezones<span class="signature">()</span><span class="type-signature"> &rarr; {Array}</span></h4> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="fluro.date.js.html">fluro.date.js</a>, <a href="fluro.date.js.html#line40">line 40</a> </li></ul></dd> </dl> <div class="description"> A function that returns all of the available timezones. Often used to populate a select box </div> <h5>Returns:</h5> <div class="param-desc"> An array of all availble timezones. </div> <dl class="param-type"> <dt> Type </dt> <dd> <span class="param-type">Array</span> </dd> </dl> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.3</a> on Tue Jun 29 2021 08:38:17 GMT+1000 (Australian Eastern Standard Time) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>