Refactor date handling in tender data model and UI components. Added unixTimestampFromJson for parsing timestamps and updated timeConvertor to handle null values. Updated relevant model fields and UI to use the new parsing logic. Added unit tests for date utilities.
This commit is contained in:
@@ -51,7 +51,7 @@ class DeadlineItem extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 4.0.h()),
|
||||
Text(
|
||||
timeConvertor(detail.submissionDeadline!),
|
||||
timeConvertor(detail.submissionDeadline),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -80,7 +80,7 @@ class DeadlineItem extends StatelessWidget {
|
||||
),
|
||||
SizedBox(height: 4.0.h()),
|
||||
Text(
|
||||
timeConvertor(detail.applicationDeadline!),
|
||||
timeConvertor(detail.applicationDeadline),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -124,7 +124,7 @@ class DeadlineItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
timeConvertor(detail.submissionDeadline!),
|
||||
timeConvertor(detail.submissionDeadline),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey70,
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -146,7 +146,7 @@ class DeadlineItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
timeConvertor(detail.applicationDeadline!),
|
||||
timeConvertor(detail.applicationDeadline),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey70,
|
||||
fontWeight: FontWeight.w400,
|
||||
|
||||
@@ -34,7 +34,7 @@ class TendersListItem extends StatelessWidget {
|
||||
SizedBox(
|
||||
width: double.infinity,
|
||||
child: Text(
|
||||
timeConvertor(tender.publicationDate ?? 0),
|
||||
timeConvertor(tender.publicationDate),
|
||||
style: TextStyle(
|
||||
fontSize: 12.0.sp(),
|
||||
fontWeight: FontWeight.w400,
|
||||
@@ -64,7 +64,7 @@ class TendersListItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
timeConvertor(tender.tenderDeadline ?? 0),
|
||||
timeConvertor(tender.tenderDeadline),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@@ -70,7 +70,7 @@ class LikedListItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
timeConvertor(tender.tenderDeadline!),
|
||||
timeConvertor(tender.tenderDeadline),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
@@ -117,7 +117,7 @@ class LikedListItem extends StatelessWidget {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
timeConvertor(tender.tenderDeadline!),
|
||||
timeConvertor(tender.tenderDeadline),
|
||||
style: TextStyle(
|
||||
fontSize: 14.0.sp(),
|
||||
fontWeight: FontWeight.w500,
|
||||
|
||||
@@ -115,7 +115,7 @@ class TenderCard extends StatelessWidget {
|
||||
|
||||
Widget _dateText() {
|
||||
return Text(
|
||||
timeConvertor(tender.publicationDate ?? 0),
|
||||
timeConvertor(tender.publicationDate),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 12.0.sp(),
|
||||
@@ -150,7 +150,7 @@ class TenderCard extends StatelessWidget {
|
||||
),
|
||||
SizedBox(width: 4.0.w()),
|
||||
Text(
|
||||
timeConvertor(tender.submissionDeadline ?? 0),
|
||||
timeConvertor(tender.submissionDeadline),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey80,
|
||||
fontSize: 14.0.sp(),
|
||||
|
||||
@@ -53,7 +53,7 @@ class TenderCard extends StatelessWidget {
|
||||
children: [
|
||||
// Date
|
||||
Text(
|
||||
timeConvertor(int.parse(tender.publicationDate!.toString())),
|
||||
timeConvertor(tender.publicationDate),
|
||||
style: TextStyle(
|
||||
color: AppColors.grey60,
|
||||
fontSize: 12.0.sp(),
|
||||
|
||||
Reference in New Issue
Block a user