What is the best way to handle validity dates in applications ?
Posted
by user214626
on Stack Overflow
See other posts from Stack Overflow
or by user214626
Published on 2010-04-06T04:05:18Z
Indexed on
2010/04/06
4:13 UTC
Read the original article
Hit count: 393
Hello,
How do we model these objects ?
Scenario 1: Price changes in a time period
EffectiveDate ExpiryDate Price
2009-01-01 2009-01-31 800$
2009-02-01 Null 900$
So, if the price changes to 910$ on 2009-02-15, then the system should automatically update the expiry date on the previous effective price to 2009-02-14, to keep it consistent.
Scenario 2: No price specified between 2009-02-01 to 2009-02-28
EffectiveDate ExpiryDate Price
2009-01-01 2009-01-31 800$
2009-03-01 Null 900$
So, if new price is specified for 2009-02-15 onwards , then the system should automatically set the expiry date on the record to be inserted to 2009-02-28, because already a record effective from 2009-03-01 exists.
Please suggest an effective way to handle these scenarios to model my framework, or are there any frameworks around that can do this .
Thanks
© Stack Overflow or respective owner