You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the get_due function expects all daily tasks to be have frequency=weekly. That is, the days of the week (within repeat) are true/false depending on whether the task is due that particular weekday.
But, since 6/11/2015, Habitica has changed to also accept frequency=daily with an everyX value corresponding to an interval and a startDate (in ISO 8601 format) for when the every X started. Obviously, this requires new code to handle it, and converting ISO 8601 to something more usable (like seconds since epoch) is nontrivial.
The User Data Display Tool handles this by including: <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
and using Moment.js to check the date for due-ness.
It would be preferable to handle this by on-demand loading if possible, as only the get_due function would use this functionality and it would be slightly cumbersome to require moment.js (or moment.min.js) be specified in the JavaScript action as a Library (and that's assuming that loading it as a library would even work).
The text was updated successfully, but these errors were encountered:
In addition to get_due, the get_tasks_by_tag_name function uses similar code to check whether a daily is due today and would need to be similarly improved.
No later than version 8.6 (15 months ago) of the UDDT, Habitica has created an isDue property for dailies that can be checked. It'd be preferable to use this property from the server instead of performing the calculations on the client.
Even if Moment.js was required, Day.js looks like a good lightweight alternative.
goldfndr
changed the title
Handle a daily task's frequency=daily
Change daily tasks get_due to use server's isDue property
Sep 15, 2018
Currently, the
get_due
function expects all daily tasks to be havefrequency
=weekly
. That is, the days of the week (withinrepeat
) are true/false depending on whether the task is due that particular weekday.But, since 6/11/2015, Habitica has changed to also accept
frequency
=daily
with aneveryX
value corresponding to an interval and astartDate
(in ISO 8601 format) for when the every X started. Obviously, this requires new code to handle it, and converting ISO 8601 to something more usable (like seconds since epoch) is nontrivial.The User Data Display Tool handles this by including:
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.10.3/moment.min.js"></script>
and using Moment.js to check the date for due-ness.
It would be preferable to handle this by on-demand loading if possible, as only the
get_due
function would use this functionality and it would be slightly cumbersome to require moment.js (or moment.min.js) be specified in the JavaScript action as a Library (and that's assuming that loading it as a library would even work).The text was updated successfully, but these errors were encountered: