Last active
September 6, 2017 12:20
-
-
Save knod/fa323fa6000415da8f5f4e766dcdce64 to your computer and use it in GitHub Desktop.
Expiring data and a possible way to handle it.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** A way to stay aware of when any code used in this script will expire. | |
* For example, if dataObj1 is only valid till June 1, 2017, then | |
* this script should only be valid till then. After that the code | |
* should be changed to point to a new, valid, object. | |
* @exports {Date} expirationDate | |
*/ | |
var expirationDate = new Date( 2018, 12, 31 ); | |
// or it could calculate the expiration date based on all the objects it's pulling in | |
var calcExpirationDate = function() { | |
var date = new Date( 2018, 12, 31 ); | |
for ( allImportedObjects ) { | |
if ( oneObj.expirationDate.getMilliseconds() < date.getMilliseconds() ) { | |
date = oneObj.expirationDate; | |
} | |
} | |
return date; | |
}; // End calcExpirationDate() | |
expirationDate = calcExpirationDate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment