OpenFn / Norwegian-Refugee-Council

Norwegian Refugee Council integrations
0 stars 3 forks source link

Fix dateString #7

Closed devnrc closed 6 years ago

devnrc commented 6 years ago

Changed from 31 of a month to 1 for all those shorter months. :)

taylordowns2000 commented 6 years ago

Thanks, @devnrc . This is great. I'd counter-propose the following, if we want to keep to the last day of each month:

     const year = f.field2.substring(0,4);
     const month = f.field2.substring(4);
     const sfDate = new Date(year, month, 0).toISOString();

Note that we also drop the unnecessary dateString step. If you like it, would you update the PR and re-submit? (Or let me know and I'll add it myself.)