Skip to content

Instantly share code, notes, and snippets.

@jsrath
Created November 2, 2018 20:47
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 jsrath/41acbac60d68ccce098beb15caebda51 to your computer and use it in GitHub Desktop.
Save jsrath/41acbac60d68ccce098beb15caebda51 to your computer and use it in GitHub Desktop.
updateExpiry = () => {
let today = new Date();
const options = { day: 'numeric', month: 'long', year: 'numeric' };
today.setDate(today.getDate() + this.state.daysLeft);
today = today.toLocaleDateString('en-GB', options);
this.setState({ expiry: today });
};
updateTotal = event => {
event.target.value = Number(event.target.value.split(',').join(''));
if (!isNaN(event.target.value)) {
const numeric = Number(event.target.value);
this.setState({ total: numeric }, () => this.updateTime());
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment