accordproject / cicero-template-library

Accord Project Template Library
https://templates.accordproject.org
Apache License 2.0
83 stars 94 forks source link

Date-time error in demandforecast template #26

Closed jeromesimeon closed 5 years ago

jeromesimeon commented 6 years ago

Running the demand forecast template raises an internal moment error/warning:


bash-3.2$ cicero execute --template ./ --dsl ./sample.txt --data ./data.json 
cicero execute --template ./ --dsl ./sample.txt --data ./data.json 
08:44:45 - info: Logging initialized. 2018-04-18T12:44:45.483Z
08:44:46 - info: CICERO-ENGINE {"request":{"$class":"org.accordproject.demandforecast.ForecastRequest","supplyForecast":1200,"transactionId":"9e1e672c-2b5d-4638-964f-6c1b7bbab75b","timestamp":"2018-04-18T12:44:46.449Z"},"response":{"$class":"org.accordproject.demandforecast.BindingResponse","transactionId":"6a3c51a0-e53f-4d20-ad2c-32d32fec8422","timestamp":"2018-04-18T12:44:46.453Z"},"data":{"$class":"org.accordproject.demandforecast.TemplateModel","purchaser":"PETER","supplier":"DAN","effectiveDate":"04/02/2018","minimumPercentage":85}}
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: 04/02/2018, _f: undefined, _strict: undefined, _locale: [object Object]
Error
    at Function.createFromInputFallback (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:324:94)
    at configFromString (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2366:11)
    at configFromInput (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2592:9)
    at prepareConfig (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2575:9)
    at createFromConfig (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2542:40)
    at createLocalOrUTC (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2629:12)
    at createLocal (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:2633:12)
    at Moment.isBefore (/Users/jeromesimeon/git/cicero/node_modules/moment/moment.js:3200:48)
    at Object.apply (/Users/jeromesimeon/git/cicero/node_modules/vm2/lib/contextify.js:288:34)
    at execute (vm.js:26:13)
08:44:46 - info: {"clause":"demandforecast@0.0.6-4e8927e99afa2d81afcc6ec5241225dd88ce1b72cfa2359dda195d4c2dc0adc8","request":{"$class":"org.accordproject.demandforecast.ForecastRequest","supplyForecast":1200},"response":{"$class":"org.accordproject.demandforecast.BindingResponse","requiredPurchase":1020,"year":2018,"quarter":2,"transactionId":"6a3c51a0-e53f-4d20-ad2c-32d32fec8422","timestamp":"2018-04-18T12:44:46.453Z"}}```

While the system recovers, this should probably be fixed either directly in the logic or in the Cicero grammar visitor for parsing dates.
jeromesimeon commented 5 years ago

Fixed way back when.