Files
GitJournal/lib/note_fileName.dart
Vishesh Handa 11a9023e99 Allow the Note FileName to be configured
This is super ugly, but it solves a real use case, and hopefully I'll
eventually get around to improving the UI of the Settings page.
2019-09-25 15:41:19 +02:00

17 lines
576 B
Dart

import 'package:journal/note.dart';
import 'package:journal/datetime_utils.dart';
import 'package:journal/settings.dart';
String getFileName(Note note) {
switch (Settings.instance.noteFileNameFormat) {
case NoteFileNameFormat.Iso8601:
return toIso8601(note.created) + ".md";
case NoteFileNameFormat.Iso8601WithTimeZone:
return toIso8601WithTimezone(note.created) + ".md";
case NoteFileNameFormat.Iso8601WithTimeZoneWithoutColon:
return toIso8601WithTimezone(note.created).replaceAll(":", "_") + ".md";
}
return note.created.toString();
}