How to exlude Weekends in reports?

Hello,

I have an app where I allow users to select dates and run reports base
off those dates. But the problem I cant figure out is how to exclude the
weekends(Sat, Sun) The report should just give data for Mon-Fri.

Thanks in advance for any help!

Don’t know if this answers your question. I think your question is a
little vague …
So I just answer the first thing I thought of when I saw your question:

(base rails 3 - don’t know which version you use)…

class Report < ActiveModel::Base/ActiveRecord::Base

validates :report_date, :no_weekend => true

end

and as validator

class NoWeekendValidator < ActiveModel::EachValidator
def validate_each(record, attribute, value)
record.errors[attribute] << (options[:message] || “mustn’t be a
weekend”) if value.saturday? || value.sunday?
end
end

I don’t know if you use a datepicker or which datepicker you could use.
But it should be possible to configure it so you can’t pick weekends.

On 01/02/11 18:36, Ithelp Eighty-five wrote:

Hello,

I have an app where I allow users to select dates and run reports base
off those dates. But the problem I cant figure out is how to exclude the
weekends(Sat, Sun) The report should just give data for Mon-Fri.

Thanks in advance for any help!


best regards
Bente P.