lib/hijri_umm_alqura.rb
def add(date = self, offset, period)
      y = period == 'y' ? (date.year + offset) : date.year 
      m = period == 'm' ? (month_of_year(date.year, date.month) + offset) : month_of_year(date.year, date.month) 
      d = date.day
      begin
        if (period == 'd' || period == 'w') 
          week_days = period == 'w' ? 7 : 1
          j_date = jd
          j_date = j_date + offset * week_days 
          result = HijriUmmAlqura.jd(j_date)
          return result
        elsif (period == 'm') 
          rys = resync_year_month(y, m)
          y  = rys[0]
          m = rys[1]
          return HijriUmmAlqura.format_date([y, m, d])
        elsif (period == 'y') 
          return HijriUmmAlqura.format_date([y, m, d])
        end
      rescue Exception => e  
        puts "Exception details: #{e.class} #{e.message}" 
      end
    end
def add(date = self, offset, period)
      y = period == 'y' ? (date.year + offset) : date.year 
      m = period == 'm' ? (month_of_year(date.year, date.month) + offset) : month_of_year(date.year, date.month) 
      d = date.day
      begin
        if (period == 'd' || period == 'w') 
          week_days = period == 'w' ? 7 : 1
          j_date = jd
          j_date = j_date + offset * week_days 
          result = HijriUmmAlqura.jd(j_date)
          return result
        elsif (period == 'm') 
          rys = resync_year_month(y, m)
          y  = rys[0]
          m = rys[1]
          return HijriUmmAlqura.format_date([y, m, d])
        elsif (period == 'y') 
          return HijriUmmAlqura.format_date([y, m, d])
        end
      rescue Exception => e  
        puts "Exception details: #{e.class} #{e.message}" 
      end
    end
Add Days - Weeks - Months - Years