Actually implement the Zettelkasten filename format

I like an idiot only exposed it in the Settings.
This commit is contained in:
Vishesh Handa
2020-08-30 15:16:03 +02:00
parent bdb3dafdab
commit a3f556df47
2 changed files with 7 additions and 0 deletions

View File

@ -464,6 +464,8 @@ class Note with NotesNotifier {
return toIso8601WithTimezone(date).replaceAll(":", "_");
case NoteFileNameFormat.UuidV4:
return Uuid().v4();
case NoteFileNameFormat.Zettelkasten:
return toZettleDateTime(date);
}
return date.toString();

View File

@ -6,6 +6,7 @@ import 'package:gitjournal/utils/logger.dart';
final _simpleDateFormat = DateFormat("yyyy-MM-dd-HH-mm-ss");
final _iso8601DateFormat = DateFormat("yyyy-MM-ddTHH:mm:ss");
final _zettleDateFormat = DateFormat("yyyyMMddHHmss");
String toSimpleDateTime(DateTime dt) {
return _simpleDateFormat.format(dt);
@ -15,6 +16,10 @@ String toIso8601(DateTime dt) {
return _iso8601DateFormat.format(dt);
}
String toZettleDateTime(DateTime dt) {
return _zettleDateFormat.format(dt);
}
String toIso8601WithTimezone(DateTime dt, [Duration offset]) {
var result = _iso8601DateFormat.format(dt);