   multiplyDivied: (other, operator) ->
     if other instanceof Quantity
       if @unit and other.unit
-        can_val = @to_ucum() # ucum.canonicalize(@value,ucum_unit(@unit))
-        other_can_value = other.to_ucum()#ucum.canonicalize(other.value,ucum_unit(other.unit))
+        can_val = @to_ucum()
+        other_can_value = other.to_ucum()
         ucum_value = ucum_multiply(can_val,[[operator,other_can_value]])
         createQuantity(ucum_value.value, units_to_string(ucum_value.units))
       else

      createQuantity( decimalAdjust("round",value,-8), @unit)

  to_ucum: ->
    u = ucum.parse(ucum_unit(@unit)) # ucum.canonicalize(@value,ucum_unit(@unit))
    u.value *= @value
    u


time_unit_to_ucum = {'year' : 'a', 'month' : 'mo',  'day' : 'd' , 'hour' : 'h', 'minute' : 'min' , 'second': 's' , 'millisecond' :  'ms', 'week' : 'wk', 'weeks' : 'wk' }


time_unit_dateTime_mapping = {'years':'year',  'months': 'month',  'days' :'day', 'hours': 'hour' ,'weeks' :'week', 'minutes': 'minute', 'seconds':'second', 'milliseconds' : 'millisecond' }

# this is used to drop the pluralization of unit fields to pass into DateTime objects for addition and subtraction operations
clean_unit = (units) ->
  if time_unit_dateTime_mapping[units] then time_unit_dateTime_mapping[units] else units

# this is used to perform any convertions of CQL date time fileds to their ucum equivalents
ucum_unit = (unit) ->
  # first strip off any pluraizations then attempt to perform a time unit to ucum unit mapping
  # otherwise send back the original value
  u = time_unit_dateTime_mapping[unit] || unit
  time_unit_to_ucum[u] ||  u || ''



module.exports.canonicalize = (value,unit) ->
  return {value: value} if unit == null
  ucv = ucum.canonicalize(value, ucum_unit(unit))
  {value: ucv.value, unit: units_to_string(ucv.units)}



#just a wrapper function to deal with possible exceptions being thrown
convert_value = (value, from ,to ) ->


  equals: (other) ->
    if other instanceof Quantity
      if (!@unit && other.unit ) || (@unit && !other.unit)
        false
      else if !@unit && !other.unit
        @value == other.value
