Skip to content

Instantly share code, notes, and snippets.

@robertcdawson
Created October 4, 2015 00:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robertcdawson/e2d07ebefffdd0cf3a10 to your computer and use it in GitHub Desktop.
Save robertcdawson/e2d07ebefffdd0cf3a10 to your computer and use it in GitHub Desktop.
// exercism.io exercise
// This function takes a date and returns a new date set one billion seconds (or gigasecond; ~31.558 years) in the future.
var Gigasecond = function(birthdate) {
this.birthdate = birthdate;
};
Gigasecond.prototype.date = function() {
var gigasecondBirthday = new Date( this.birthdate.setSeconds( this.birthdate.getSeconds() + Math.pow(10, 9) ) );
var gigasecondBirthdayMidnight = gigasecondBirthday.setHours( 0, 0, 0, 0 );
var getDate = new Date(gigasecondBirthdayMidnight);
return getDate;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment