finish birthday feature

This commit is contained in:
David Ralph
2020-12-01 13:16:13 +00:00
parent 12e7ec8995
commit f60aae6b24
2 changed files with 3 additions and 2 deletions

View File

@@ -28,12 +28,13 @@ export default class GreetingSettings extends React.PureComponent {
<Section title={this.props.language.greeting.title} name='greeting'>
<Checkbox name='events' text={this.props.language.greeting.events} />
<Checkbox name='defaultGreetingMessage' text={this.props.language.greeting.default} />
<Checkbox name='birthdayenabled' text='Birthday Enabled' />
<ul>
<p>{this.props.language.greeting.name} <span className='modalLink' onClick={() => this.resetItem()}>{this.props.language.reset}</span></p>
<input type='text' id='greetingName'></input>
</ul>
<ul>
<p>Birthday Date <span className='modalLink' onClick={() => this.changeDate('reset')}>{this.props.language.reset}</span></p>
<p>Birthday Date</p>
<DatePicker onChange={(data) => this.changeDate(data)} value={this.state.birthday}/>
</ul>
</Section>

View File

@@ -49,7 +49,7 @@ export default class Greeting extends React.PureComponent {
// Birthday
const birth = new Date(localStorage.getItem('birthday'));
if (birth.getDate() === now.getDate() && birth.getMonth() === now.getMonth() && birth.getFullYear() !== 1001) message = 'Happy Birthday';
if (localStorage.getItem('birthdayenabled') === 'true' && birth.getDate() === now.getDate() && birth.getMonth() === now.getMonth()) message = 'Happy Birthday';
// Set the state to the greeting string
this.setState({ greeting: `${message}${name}` });