fable 3.0.95 → 3.0.96

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3340,24 +3340,5 @@ var tmpChunkSize=typeof pChunkSize=='number'?pChunkSize:0;var tmpChunkCache=type
3340
3340
  // This is not meant to replace the more complex libraries such as moment or luxon.
3341
3341
  // This *is* meant to be a simple, small, and fast way to convert ISO strings to dates in engines
3342
3342
  // with ultra limited JS capabilities where those don't work.
3343
- },{key:"isoStringToDate",value:function isoStringToDate(pISOString){// Split the string into an array based on the digit groups.
3344
- var tmpDateParts=pISOString.split(/\D+/);// Set up a date object with the current time.
3345
- var tmpReturnDate=new Date();// Track the number of hours we need to adjust the date by based on the timezone.
3346
- var tmpTimeZoneOffsetInHours=0;// Track the number of minutes we need to adjust the date by based on the timezone.
3347
- var tmpTimeZoneOffsetInMinutes=0;// This fixes an inconsistency with constructing the date programmatically.
3348
- tmpReturnDate.setUTCDate(1);tmpReturnDate.setUTCMonth(1);tmpReturnDate.setUTCHours(0);tmpReturnDate.setUTCMinutes(0);tmpReturnDate.setUTCSeconds(0);tmpReturnDate.setUTCMilliseconds(0);// Manually parse the parts of the string and set each part for the
3349
- // date. Note: Using the UTC versions of these functions is necessary
3350
- // because we're manually adjusting for time zones stored in the
3351
- // string.
3352
- tmpReturnDate.setUTCFullYear(parseInt(tmpDateParts[0]));// The month numbers are one "off" from what normal humans would expect
3353
- // because January == 0.
3354
- tmpReturnDate.setUTCMonth(parseInt(tmpDateParts[1])-1);tmpReturnDate.setUTCDate(parseInt(tmpDateParts[2]));// Set the time parts of the date object.
3355
- tmpReturnDate.setUTCHours(parseInt(tmpDateParts[3]));tmpReturnDate.setUTCMinutes(parseInt(tmpDateParts[4]));tmpReturnDate.setUTCSeconds(parseInt(tmpDateParts[5]));tmpReturnDate.setUTCMilliseconds(parseInt(tmpDateParts[6]));// If there's a value for either the hours or minutes offset.
3356
- if(tmpDateParts[7]||tmpDateParts[8]){// If there's a value for the minutes offset.
3357
- if(tmpDateParts[8]){// Convert the minutes value into an hours value.
3358
- tmpTimeZoneOffsetInMinutes=parseInt(tmpDateParts[8])/60;}// Add the hours and minutes values to get the total offset in hours.
3359
- tmpTimeZoneOffsetInHours=parseInt(tmpDateParts[7])+tmpTimeZoneOffsetInMinutes;// If the sign for the timezone is a plus to indicate the timezone is ahead of UTC time.
3360
- if(pISOString.substr(-6,1)=="+"){// Make the offset negative since the hours will need to be subtracted from the date.
3361
- tmpTimeZoneOffsetInHours*=-1;}}// Get the current hours for the date and add the offset to get the correct time adjusted for timezone.
3362
- tmpReturnDate.setHours(tmpReturnDate.getHours()+tmpTimeZoneOffsetInHours);// Return the Date object calculated from the string.
3363
- return tmpReturnDate;}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"async.eachlimit":1,"async.waterfall":15,"big.js":17,"fable-serviceproviderbase":43}]},{},[115])(115);});
3343
+ },{key:"isoStringToDate",value:function isoStringToDate(pISOString){if(!this.fable.hasOwnProperty('Dates')){this.fable.instantiateServiceProvider('Dates');}var tmpDate=false;try{tmpDate=this.fable.Dates.dayJS.utc(pISOString);}catch(pError){// TODO: Should this throw? Doubtful.
3344
+ this.fable.log.error("Could not parse date string ".concat(pISOString," with dayJS."));return false;}if(tmpDate){return tmpDate.toDate();}else{return false;}}}]);return FableServiceUtility;}(libFableServiceBase);module.exports=FableServiceUtility;},{"async.eachlimit":1,"async.waterfall":15,"big.js":17,"fable-serviceproviderbase":43}]},{},[115])(115);});