Add ISO dates to search so we can query by them

This commit is contained in:
2025-05-24 14:52:09 +02:00
parent 29f6f28f12
commit 64884cbb42

View File

@@ -350,6 +350,7 @@ Future<Note> createNote(String content) async {
final document = { final document = {
'id': generateRandomString(32), 'id': generateRandomString(32),
'date': DateTime.now().toUtc().millisecondsSinceEpoch, 'date': DateTime.now().toUtc().millisecondsSinceEpoch,
'dateISO': DateTime.now().toUtc().toIso8601String(),
'content': content, 'content': content,
'topLetter': mostFrequentLetter, 'topLetter': mostFrequentLetter,
'topLetterFrequency': mostFrequentLetterCount, 'topLetterFrequency': mostFrequentLetterCount,
@@ -433,6 +434,10 @@ Future<void> updateNote(Note note) async {
'id': note.id, 'id': note.id,
'content': trimmedContent, 'content': trimmedContent,
'date': note.epochTime, 'date': note.epochTime,
'dateISO':
DateTime.fromMillisecondsSinceEpoch(
note.epochTime,
).toUtc().toIso8601String(),
'topLetter': mostFrequentLetter, 'topLetter': mostFrequentLetter,
'topLetterFrequency': mostFrequentLetterRatio, 'topLetterFrequency': mostFrequentLetterRatio,
}; };