mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-07-15 07:56:11 +08:00
Do not add a 'created' field if it does not exist
It should, but it's fine if it doesn't. It does look a bit strange since Dart puts the date to Nov 0001, but whatever.
This commit is contained in:
@ -41,13 +41,11 @@ class Note implements Comparable {
|
||||
}
|
||||
}
|
||||
|
||||
// FIXME: Get created from file system or from git!
|
||||
if (created == null) {
|
||||
// FIXME: make this 0
|
||||
created = DateTime.now();
|
||||
json.remove("created");
|
||||
}
|
||||
|
||||
json.remove("created");
|
||||
if (created == null) {
|
||||
created = DateTime(0, 0, 0, 0, 0, 0, 0, 0);
|
||||
}
|
||||
|
||||
String body = "";
|
||||
@ -66,7 +64,10 @@ class Note implements Comparable {
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
var json = Map<String, dynamic>.from(extraProperties);
|
||||
json['created'] = toIso8601WithTimezone(created);
|
||||
var createdStr = toIso8601WithTimezone(created);
|
||||
if (!createdStr.startsWith("00")) {
|
||||
json['created'] = createdStr;
|
||||
}
|
||||
json['body'] = body;
|
||||
json['fileName'] = fileName;
|
||||
|
||||
|
Reference in New Issue
Block a user