mirror of
https://github.com/go-vikunja/app
synced 2025-02-11 09:12:49 +00:00
Fix date format
This commit is contained in:
parent
236cf4e186
commit
f973d3940f
@ -120,9 +120,9 @@ class VikunjaGlobalState extends State<VikunjaGlobal> {
|
||||
});
|
||||
return;
|
||||
}
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||
} catch (otherExceptions) {
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "", "");
|
||||
loadedCurrentUser = User(int.tryParse(currentUser), "", "");
|
||||
}
|
||||
setState(() {
|
||||
_client = client;
|
||||
|
@ -23,8 +23,8 @@ class TaskList {
|
||||
owner = User.fromJson(json['owner']),
|
||||
description = json['description'],
|
||||
title = json['title'],
|
||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
||||
updated = DateTime.parse(json['updated']),
|
||||
created = DateTime.parse(json['created']),
|
||||
tasks = (json['tasks'] == null ? [] : json['tasks'] as List<dynamic>)
|
||||
?.map((taskJson) => Task.fromJson(taskJson))
|
||||
?.toList();
|
||||
@ -35,8 +35,8 @@ class TaskList {
|
||||
"title": this.title,
|
||||
"description": this.description,
|
||||
"owner": this.owner?.toJSON(),
|
||||
"created": this.created?.millisecondsSinceEpoch,
|
||||
"updated": this.updated?.millisecondsSinceEpoch,
|
||||
"created": this.created?.toIso8601String(),
|
||||
"updated": this.updated?.toIso8601String(),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
@ -19,13 +19,13 @@ class Namespace {
|
||||
: name = json['name'],
|
||||
description = json['description'],
|
||||
id = json['id'],
|
||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
||||
created = DateTime.parse(json['created']),
|
||||
updated = DateTime.parse(json['updated']),
|
||||
owner = User.fromJson(json['owner']);
|
||||
|
||||
toJSON() => {
|
||||
"created": created?.millisecondsSinceEpoch,
|
||||
"updated": updated?.millisecondsSinceEpoch,
|
||||
"created": created?.toIso8601String(),
|
||||
"updated": updated?.toIso8601String(),
|
||||
"name": name,
|
||||
"owner": owner?.toJSON(),
|
||||
"description": description
|
||||
|
@ -22,12 +22,12 @@ class Task {
|
||||
|
||||
Task.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
updated = DateTime.fromMillisecondsSinceEpoch(json['updated']),
|
||||
created = DateTime.fromMillisecondsSinceEpoch(json['created']),
|
||||
updated = DateTime.parse(json['updated']),
|
||||
created = DateTime.parse(json['created']),
|
||||
reminders = (json['reminderDates'] as List<dynamic>)
|
||||
?.map((milli) => DateTime.fromMillisecondsSinceEpoch(milli))
|
||||
?.map((r) => DateTime.parse(r))
|
||||
?.toList(),
|
||||
due = DateTime.fromMillisecondsSinceEpoch(json['dueDate']),
|
||||
due = DateTime.parse(json['dueDate']),
|
||||
description = json['description'],
|
||||
text = json['text'],
|
||||
done = json['done'],
|
||||
@ -35,11 +35,11 @@ class Task {
|
||||
|
||||
toJSON() => {
|
||||
'id': id,
|
||||
'updated': updated?.millisecondsSinceEpoch,
|
||||
'created': created?.millisecondsSinceEpoch,
|
||||
'updated': updated?.toIso8601String(),
|
||||
'created': created?.toIso8601String(),
|
||||
'reminderDates':
|
||||
reminders?.map((date) => date.millisecondsSinceEpoch)?.toList(),
|
||||
'dueDate': due?.millisecondsSinceEpoch,
|
||||
reminders?.map((date) => date.toIso8601String())?.toList(),
|
||||
'dueDate': due?.toIso8601String(),
|
||||
'description': description,
|
||||
'text': text,
|
||||
'done': done ?? false,
|
||||
|
@ -1,18 +1,20 @@
|
||||
import 'package:flutter/cupertino.dart';
|
||||
import 'package:vikunja_app/global.dart';
|
||||
|
||||
class User {
|
||||
final int id;
|
||||
final String email, username, avatarHash;
|
||||
final String email, username;
|
||||
|
||||
User(this.id, this.email, this.username, this.avatarHash);
|
||||
User(this.id, this.email, this.username);
|
||||
User.fromJson(Map<String, dynamic> json)
|
||||
: id = json['id'],
|
||||
email = json.containsKey('email') ? json['email'] : '',
|
||||
username = json['username'],
|
||||
avatarHash = json['avatarUrl'];
|
||||
username = json['username'];
|
||||
|
||||
toJSON() => {"id": this.id, "email": this.email, "username": this.username};
|
||||
|
||||
String avatarUrl() {
|
||||
return "https://secure.gravatar.com/avatar/" + this.avatarHash;
|
||||
String avatarUrl(BuildContext context) {
|
||||
return VikunjaGlobal.of(context).client.base + "/" + this.username + "/avatar";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,7 +101,7 @@ class HomePageState extends State<HomePage> with AfterLayoutMixin<HomePage> {
|
||||
currentAccountPicture: currentUser == null
|
||||
? null
|
||||
: CircleAvatar(
|
||||
backgroundImage: NetworkImage(currentUser.avatarUrl()),
|
||||
backgroundImage: NetworkImage(currentUser.avatarUrl(context)),
|
||||
),
|
||||
decoration: BoxDecoration(
|
||||
image: DecorationImage(
|
||||
|
@ -7,7 +7,7 @@ import 'package:vikunja_app/models/user.dart';
|
||||
import 'package:vikunja_app/service/services.dart';
|
||||
|
||||
// Data for mocked services
|
||||
var _users = {1: User(1, 'test@testuser.org', 'test1', '')};
|
||||
var _users = {1: User(1, 'test@testuser.org', 'test1')};
|
||||
|
||||
var _namespaces = {
|
||||
1: Namespace(
|
||||
|
Loading…
x
Reference in New Issue
Block a user