ValidityPeriods

10/02/2009 4:13 PM

Validity Periods

Representation

Ok, so the plan is to be able to represent two different validity periods with a single set of fields. The two types of expiry we wish to represent are period, "this record expires after a given number of days / months", and fixed, "this record expires on April 4th every year". We will represent the first schema, period, using "+<number of time units>". For example +3 in the months field would mean that the record expires 3 months from todays date, and +40 in the days field would mean the record expires 40 days from todays date. We will represent the second schema, fixed, using the numerical number for the time unit. For example April 2nd would be represented by 4 in the months field and 2 in the days field. Now, you can also use these type in combination, for example "expire on the 1st of the month in 2 months" would be represented by +2 in the months field an 1 in the days field.

Calculation

The idea is that if your previous expiry date is before the one calculated based on today, your new expiry is either your old expiry extended by the validity period or the expiry calculated from today... whichever is later.

Special case

+0 +0 - on the client side this is defined as "Never expires". This case is specially picked up on the server and converted to "Null Null" before it is passed on to the database. The algorithm in the Database will actually treat +0 +0 as equivalent to +12 +0. -- Andy

Tags:
Home: WikiStart
What's new: Recently changed articles
You can subscribe to this wiki article using an RSS feed reader.