niwaa / quizzify

Generate Gap Fill questions from wikipedia articles
1 stars 1 forks source link

Deprecation warning (probably not a big deal, just documenting!) #1

Open senorflor opened 6 years ago

senorflor commented 6 years ago
Deprecation warning: value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged and will be removed in an upcoming major release. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.
Arguments:
[0] _isAMomentObject: true, _isUTC: false, _useUTC: false, _l: undefined, _i: september 17 1991, _f: undefined, _strict: undefined, _locale: [object Object]
Error
    at Function.createFromInputFallback ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:324:94)
    at configFromString ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2366:11)
    at configFromInput ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2592:9)
    at prepareConfig ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2575:9)
    at createFromConfig ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2542:40)
    at createLocalOrUTC ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2629:12)
    at createLocal ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:2633:12)
    at hooks ([PATH-TO-REPO]/quizzify/node_modules/moment/moment.js:16:25)
    at Object.Distractors.selectNearDates ([PATH-TO-REPO]/quizzify/src/distractors.js:119:14)
    at Object.Distractors.getSelection ([PATH-TO-REPO]/quizzify/src/distractors.js:73:31)
senorflor commented 6 years ago

Repro call:

GET /getGFQ?title=linux 200 593.425 ms - 962
niwaa commented 6 years ago

This is due to a selectNearDates() function which was (too) quickly added in order to return similar dates as distractor. Date string inputs should have first been normalized. Then ideally the output format should match the input format.

Format a. 
1800 -> 1700, 1810

Format b.
December 12th 2017 -> October 11th, November 4th 2018