Skip to content

Commit

Permalink
Implement- Show upcoming Events
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-sneha-s committed Mar 13, 2024
1 parent 0513d0a commit 24e4f4d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 9 deletions.
6 changes: 4 additions & 2 deletions lib/data/core/utils/date_formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,10 +97,12 @@ class DateFormatter {

String showAnniversaries({required DateTime dateTime,required String name, int? number}){
final today = DateTime.now().dateOnly;
final difference= dateTime.difference(today);
int yearDifference= (difference.inDays/365).floor();
if(dateTime.dateOnly.isAtSameMomentAs(today)){
return _localization.present_birthday_text(name);
return _localization.present_anniversary_text(name, yearDifference);
}else{
return "${_localization.upcoming_birthday_text(name)} ${getDateRepresentation(dateTime)}🎉";
return "${_localization.upcoming_anniversary_text(name, yearDifference)} ${getDateRepresentation(dateTime)}🎉";
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/data/l10n/app_en.arb
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@
}
}
},
"present_anniversary_text":"Congratulations on {years} with us {name}! Keep up the good work! ",
"present_anniversary_text":"Congratulations on {years} with us {name} 💐💐! Keep up the good work! ",
"@present_anniversary_text":{
"placeholders":{
"name":{
Expand Down
3 changes: 1 addition & 2 deletions lib/data/model/employee/employee.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 8 additions & 4 deletions lib/ui/shared/events/model/event.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
class Event{
import 'package:flutter/material.dart';

class Event {
final String name;
final String? imageUrl;
final DateTime dateTime;
DateTime dateTime;

Event({required this.name,required this.dateTime,this.imageUrl});
}
Event({required this.name, required this.dateTime, this.imageUrl}) {
dateTime = DateUtils.dateOnly(dateTime);
}
}

0 comments on commit 24e4f4d

Please sign in to comment.