nl_tokens: Returns a date range that intersects two date info objects NOTE : This is a shallow calculation ( does not take patterns into account ) so this method should only really be called for special conditions where absolute accuracy is not necessarily needed
pl_tokens: function findShallowIntersectingRange ( date1 , date2 ) { const thisRange = date1 . toRange ( ) ; const otherRange = date2 . toRange ( ) ; // Start with infinite start and end dates let start = null ; let end = null ; // This start date exists if ( thisRange . start ) { // Use this definite start date if other start date is infinite if ( ! otherRange . start ) start = thisRange . start ; else // Otherwise, use the earliest start date <mask> = thisRange . start < otherRange . start ? thisRange . start : otherRange . start ; // Other start date exists } else if ( otherRange . start ) { // Use other definite start date as this one is infinite start = otherRange . start ; } // Assign end date to this one if it is valid if ( thisRange . end && ( ! start || thisRange . end >= start ) ) { end = thisRange . end ; } // Assign end date to other one if it is valid and before this one if ( otherRange . end && ( ! start || otherRange . end >= start ) ) { if ( ! end || otherRange . end < end ) end = otherRange . end ; } // Return calculated range return { start , end } ; }