Skip to content

Commit

Permalink
Improve date handling (#118)
Browse files Browse the repository at this point in the history
* Handle dates with Luxon

* Additional format

* Feedback

* Object type

* Welcome back moment

* lint

* Feedback

* Tests + docs

* Restructure + more tests

* Look at this later

* Fix failing test

Co-authored-by: Kenn Sippell <[email protected]>
  • Loading branch information
eljhkrr and kennsippell authored Jul 6, 2021
1 parent a42a2ac commit 39fe990
Show file tree
Hide file tree
Showing 21 changed files with 281 additions and 106 deletions.
112 changes: 93 additions & 19 deletions docs/Harness.html
Original file line number Diff line number Diff line change
Expand Up @@ -886,7 +886,7 @@ <h4 class="name" id="consoleErrors"><span class="type-signature"></span>consoleE

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line515">line 515</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line501">line 501</a>
</li></ul></dd>


Expand Down Expand Up @@ -953,7 +953,7 @@ <h4 class="name" id="content"><span class="type-signature"></span>content<span c

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line541">line 541</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line527">line 527</a>
</li></ul></dd>


Expand Down Expand Up @@ -1015,7 +1015,7 @@ <h4 class="name" id="coreVersion"><span class="type-signature"></span>coreVersio

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line536">line 536</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line522">line 522</a>
</li></ul></dd>


Expand Down Expand Up @@ -1077,7 +1077,7 @@ <h4 class="name" id="state"><span class="type-signature"></span>state<span class

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line564">line 564</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line576">line 576</a>
</li></ul></dd>


Expand Down Expand Up @@ -1139,7 +1139,75 @@ <h4 class="name" id="user"><span class="type-signature"></span>user<span class="

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line524">line 524</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line510">line 510</a>
</li></ul></dd>







</dl>








<h4 class="name" id="userSettingsDoc"><span class="type-signature"></span>userSettingsDoc<span class="type-signature"></span></h4>




<div class="description">
`userSettingsDoc` from the <a href="global.html#HarnessInputs">HarnessInputs</a> set through the constructor
</div>







<dl class="details">
























<dt class="tag-default">Default Value:</dt>
<dd class="tag-default"><ul class="dummy">
<li>{Object} A constructed object of type `user-settings` https://docs.communityhealthtoolkit.org/core/overview/db-schema/#users based on
known user information</li>
</ul></dd>



<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line545">line 545</a>
</li></ul></dd>


Expand Down Expand Up @@ -1517,7 +1585,7 @@ <h6>Properties</h6>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line389">line 389</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line375">line 375</a>
</li></ul></dd>


Expand Down Expand Up @@ -1717,7 +1785,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line212">line 212</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line211">line 211</a>
</li></ul></dd>


Expand Down Expand Up @@ -1901,7 +1969,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line303">line 303</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line289">line 289</a>
</li></ul></dd>


Expand Down Expand Up @@ -2022,6 +2090,9 @@ <h5>Parameters:</h5>
<span class="param-type">Object</span>
|

<span class="param-type">Duration</span>
|

<span class="param-type">number</span>


Expand All @@ -2032,7 +2103,7 @@ <h5>Parameters:</h5>



<td class="description last">Either an object describing how far to move forward in time. Has attributes { years, days, hours, minutes, seconds, ms }. Or an number describing how many days to move forward in time.</td>
<td class="description last">An object with attributes { years, quarters, months, weeks, days, hours, minutes, seconds, milliseconds } describing how far to move forward in time, a <a href="https://moment.github.io/luxon/docs/class/src/duration.js~Duration.html">Duration object</a> or a number describing how many days to move forward in time.</td>
</tr>


Expand Down Expand Up @@ -2073,7 +2144,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line272">line 272</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line269">line 269</a>
</li></ul></dd>


Expand Down Expand Up @@ -2294,7 +2365,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line620">line 620</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line632">line 632</a>
</li></ul></dd>


Expand Down Expand Up @@ -2404,7 +2475,7 @@ <h4 class="name" id="getNow"><span class="type-signature"></span>getNow<span cla

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line261">line 261</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line258">line 258</a>
</li></ul></dd>


Expand Down Expand Up @@ -2639,7 +2710,7 @@ <h6>Properties</h6>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line425">line 425</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line411">line 411</a>
</li></ul></dd>


Expand Down Expand Up @@ -2990,7 +3061,7 @@ <h6>Properties</h6>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line343">line 343</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line329">line 329</a>
</li></ul></dd>


Expand Down Expand Up @@ -3149,7 +3220,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line471">line 471</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line457">line 457</a>
</li></ul></dd>


Expand Down Expand Up @@ -3651,7 +3722,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line570">line 570</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line582">line 582</a>
</li></ul></dd>


Expand Down Expand Up @@ -3740,6 +3811,9 @@ <h5>Parameters:</h5>
<span class="param-type">Date</span>
|

<span class="param-type">DateTime</span>
|

<span class="param-type">number</span>
|

Expand All @@ -3753,7 +3827,7 @@ <h5>Parameters:</h5>



<td class="description last">A Date object or a value which can be parsed into a Date</td>
<td class="description last">A Date object, <a href="https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html">DateTime object</a> or a value which can be parsed into a Date</td>
</tr>


Expand Down Expand Up @@ -3794,7 +3868,7 @@ <h5>Parameters:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line245">line 245</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line244">line 244</a>
</li></ul></dd>


Expand Down Expand Up @@ -4076,7 +4150,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
3 changes: 2 additions & 1 deletion docs/core-adapter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ <h1 class="page-title">Source: core-adapter.js</h1>
chtCore.RulesEmitter.initialize({
rules: appSettings.tasks.rules,
contact: user,
taskSchedules: rulesSettings.taskSchedules
});
}
};
Expand Down Expand Up @@ -240,7 +241,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/dev-mode_mock.cht-conf.contact-summary-lib.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/dev-mode_mock.cht-conf.nools-lib.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/dev-mode_mock.rules-engine.rules-emitter.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
2 changes: 1 addition & 1 deletion docs/form-host_form-filler.js.html
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
6 changes: 3 additions & 3 deletions docs/global.html
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line605">line 605</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line617">line 617</a>
</li></ul></dd>


Expand Down Expand Up @@ -1020,7 +1020,7 @@ <h5 class="subsection-title">Properties:</h5>

<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line553">line 553</a>
<a href="harness.js.html">harness.js</a>, <a href="harness.js.html#line565">line 565</a>
</li></ul></dd>


Expand Down Expand Up @@ -1633,7 +1633,7 @@ <h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="mock.cht-
<br class="clear">

<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jun 07 2021 14:28:18 GMT+0300 (Eastern European Summer Time)
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.6</a> on Mon Jul 05 2021 17:51:02 GMT+0300 (East Africa Time)
</footer>

<script> prettyPrint(); </script>
Expand Down
Loading

0 comments on commit 39fe990

Please sign in to comment.