mirror of
https://github.com/mue/mue.git
synced 2026-07-15 21:13:54 +02:00
finish birthday feature
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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}` });
|
||||
|
||||
Reference in New Issue
Block a user