[Offline Apps] Date tokens not found when replacing with data

Forge Component
Published on 2015-11-19 by Labs
26 votes
Published on 2015-11-19 by Labs
The following code in OfflineStorageJavaScript causes the date comparisons to fail during data replacement when the outsystems server date time format is changed as it formats to a hard coded YYYY-MM-DD, we want to use DD/MM/YYYY.
To reproduce this: change the format and view the sample application - the sample contact shows a birth date which is the date set in the template record showing that it was not matched during data replacement.

I cannot get around this as the routines i need to change are private, Is there any chance of getting this updated, or can you suggest the best way of fixing this for forms (perhaps at some point during initialisation I can replace the token with one formatted in the date format expected). Note that you can specify a token directly in an input widget instead of connecting to the sample data action on a table or list records, but this cannot be done in a form.
Another alternative may be to change the output from the "CreateSampleRecord" action.

function getDateString(value) {
    var parsedDate = new Date(Date.parse(value));
    return parsedDate.getUTCFullYear() + '-' + pad((parsedDate.getUTCMonth() + 1)) + '-' + pad(parsedDate.getUTCDate());
Hi Alan!

Did you manage to solve this issue? I regret that I didn't read your post sooner...
No, I cannot get around this as the routines that need to change are private.
The issue described in this thread was fixed on the 1.2.6 version of Offline Apps, published today on the Forge.

Just for future reference, this component and all other components published by Outsystems Labs are open-source, so if you find an issue and know how to correct it, feel free to do so and share the fix with the component's team.

Thanks heaps, I did not realise it was open source.