smc-calendar
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Smc-calendar] Re: a doubt - calendar


From: Praveen A
Subject: [Smc-calendar] Re: a doubt - calendar
Date: Mon, 5 Jan 2009 17:45:22 -0800

How do we handle dates before era start? Like BC for gregarian. Or isValid should check if date is after era start? How is it done in other calendars? I will check it in a while.

On Jan 5, 2009 11:04 AM, "മഹേഷ് മുകുന്ദന് | Mahesh M" <address@hidden> wrote:

bool KCalendarSystemIndic::isValid( const QDate &date ) const
{
    return KCalendarSystem::isValid( date );
}

bool KCalendarSystem::isValid( const QDate &date ) const
{
    if ( date.isNull() || date < earliestValidDate() || date > latestValidDate() ) {
        return false;
    }
    return true;
}

Here the earliestvaliddate of Kcalendarsystem and Kcalendarsystemindic are  different. Since we have defined one should we be doing it this way?

Same thing here also:

bool KCalendarSystemIndic::setDate( QDate &date, int year, int month, int day ) const
{
    return KCalendarSystem::setDate( date, year, month, day );
}

bool KCalendarSystem::setDate( QDate &date, int year, int month, int day ) const
{
    if ( isValid( year, month, day ) ) {
        int jd;
        dateToJulianDay( year, month, day, jd );
        date = QDate::fromJulianDay( jd );
        return true;
    }

    return false;
}

the isvalid called is different.

Wont that make a difference?

--
Mahesh M
Happy hacking...
       ,           ,
      /             \
((__-^^-,-^^-__))
   `-_---' `---_-'
     `--|o` 'o|--'
          \  `  /
           ): :(
          :o_o:
            "-"


reply via email to

[Prev in Thread] Current Thread [Next in Thread]