Refactor note handling to use epoch time and improve utility functions for settings management
This commit is contained in:
@@ -2,7 +2,7 @@ import 'package:intl/intl.dart';
|
||||
|
||||
class Note {
|
||||
final String id;
|
||||
final String date;
|
||||
final int epochTime;
|
||||
late final String displayDate;
|
||||
String content;
|
||||
String? snippet;
|
||||
@@ -11,21 +11,22 @@ class Note {
|
||||
|
||||
Note({
|
||||
required this.id,
|
||||
required this.date,
|
||||
required this.epochTime,
|
||||
required this.content,
|
||||
this.snippet,
|
||||
this.isProblematic = false,
|
||||
this.problemReason = '',
|
||||
}) {
|
||||
final dtUtc = DateFormat('yyyy-MM-dd HH:mm:ss').parse(date, true);
|
||||
final dtUtc = DateTime.fromMillisecondsSinceEpoch(epochTime, isUtc: true);
|
||||
final dtLocal = dtUtc.toLocal();
|
||||
displayDate = DateFormat('yyyy-MM-dd HH:mm:ss').format(dtLocal);
|
||||
}
|
||||
}
|
||||
|
||||
class Scratch {
|
||||
final String date;
|
||||
final int epochTime;
|
||||
final String id;
|
||||
String content;
|
||||
|
||||
Scratch({required this.date, required this.content});
|
||||
Scratch({required this.id, required this.epochTime, required this.content});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user