mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 10:34:17 +00:00
Use ISO 8601 as the default datetime format
This commit is contained in:
parent
8c871d83d0
commit
281e568edf
@ -96,9 +96,9 @@ def ressource_after_update_handler(mapper, connection, ressource):
|
|||||||
if not history.has_changes():
|
if not history.has_changes():
|
||||||
continue
|
continue
|
||||||
new_value = history.added[0]
|
new_value = history.added[0]
|
||||||
# DateTime attributes must be converted to a timestamp
|
# DateTime attributes must be converted to a string
|
||||||
if isinstance(new_value, datetime):
|
if isinstance(new_value, datetime):
|
||||||
new_value = new_value.timestamp()
|
new_value = new_value.isoformat()
|
||||||
jsonpatch.append(
|
jsonpatch.append(
|
||||||
{
|
{
|
||||||
'op': 'replace',
|
'op': 'replace',
|
||||||
|
@ -157,8 +157,8 @@ class User(UserMixin, db.Model):
|
|||||||
'role_id': self.role_id,
|
'role_id': self.role_id,
|
||||||
'confirmed': self.confirmed,
|
'confirmed': self.confirmed,
|
||||||
'email': self.email,
|
'email': self.email,
|
||||||
'last_seen': self.last_seen.timestamp(),
|
'last_seen': self.last_seen.isoformat(),
|
||||||
'member_since': self.member_since.timestamp(),
|
'member_since': self.member_since.isoformat(),
|
||||||
'settings': {'dark_mode': self.setting_dark_mode,
|
'settings': {'dark_mode': self.setting_dark_mode,
|
||||||
'job_status_mail_notifications':
|
'job_status_mail_notifications':
|
||||||
self.setting_job_status_mail_notifications,
|
self.setting_job_status_mail_notifications,
|
||||||
@ -433,9 +433,9 @@ class Job(db.Model):
|
|||||||
'url': self.url,
|
'url': self.url,
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'user_id': self.user_id,
|
'user_id': self.user_id,
|
||||||
'creation_date': self.creation_date.timestamp(),
|
'creation_date': self.creation_date.isoformat(),
|
||||||
'description': self.description,
|
'description': self.description,
|
||||||
'end_date': self.end_date.timestamp() if self.end_date else None,
|
'end_date': self.end_date.isoformat() if self.end_date else None,
|
||||||
'service': self.service,
|
'service': self.service,
|
||||||
'service_args': self.service_args,
|
'service_args': self.service_args,
|
||||||
'service_version': self.service_version,
|
'service_version': self.service_version,
|
||||||
@ -557,11 +557,11 @@ class Corpus(db.Model):
|
|||||||
'url': self.url,
|
'url': self.url,
|
||||||
'id': self.id,
|
'id': self.id,
|
||||||
'user_id': self.user_id,
|
'user_id': self.user_id,
|
||||||
'creation_date': self.creation_date.timestamp(),
|
'creation_date': self.creation_date.isoformat(),
|
||||||
'current_nr_of_tokens': self.current_nr_of_tokens,
|
'current_nr_of_tokens': self.current_nr_of_tokens,
|
||||||
'description': self.description,
|
'description': self.description,
|
||||||
'status': self.status,
|
'status': self.status,
|
||||||
'last_edited_date': self.last_edited_date.timestamp(),
|
'last_edited_date': self.last_edited_date.isoformat(),
|
||||||
'max_nr_of_tokens': self.max_nr_of_tokens,
|
'max_nr_of_tokens': self.max_nr_of_tokens,
|
||||||
'title': self.title,
|
'title': self.title,
|
||||||
}
|
}
|
||||||
|
@ -91,13 +91,13 @@ class CorpusDisplay extends RessourceDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCreationDate(creationDateTimestamp) {
|
setCreationDate(iso8601CreationDate) {
|
||||||
let creationDate = new Date(creationDateTimestamp * 1000).toLocaleString("en-US");
|
let creationDate = new Date(iso8601CreationDate).toLocaleString("en-US");
|
||||||
for (let element of this.displayElement.querySelectorAll('.corpus-creation-date')) {this.setElement(element, creationDate);}
|
for (let element of this.displayElement.querySelectorAll('.corpus-creation-date')) {this.setElement(element, creationDate);}
|
||||||
}
|
}
|
||||||
|
|
||||||
setLastEditedDate(endDateTimestamp) {
|
setLastEditedDate(iso8601LastEditedDate) {
|
||||||
let endDate = new Date(endDateTimestamp * 1000).toLocaleString("en-US");
|
let endDate = new Date(iso8601LastEditedDate).toLocaleString("en-US");
|
||||||
for (let element of this.displayElement.querySelectorAll('.corpus-end-date')) {this.setElement(element, endDate);}
|
for (let element of this.displayElement.querySelectorAll('.corpus-end-date')) {this.setElement(element, endDate);}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,13 +63,13 @@ class JobDisplay extends RessourceDisplay {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setCreationDate(creationDateTimestamp) {
|
setCreationDate(iso8601CreationDate) {
|
||||||
let creationDate = new Date(creationDateTimestamp * 1000).toLocaleString("en-US");
|
let creationDate = new Date(iso8601CreationDate).toLocaleString("en-US");
|
||||||
for (let element of this.displayElement.querySelectorAll('.job-creation-date')) {this.setElement(element, creationDate);}
|
for (let element of this.displayElement.querySelectorAll('.job-creation-date')) {this.setElement(element, creationDate);}
|
||||||
}
|
}
|
||||||
|
|
||||||
setEndDate(endDateTimestamp) {
|
setEndDate(iso8601EndDate) {
|
||||||
let endDate = new Date(endDateTimestamp * 1000).toLocaleString("en-US");
|
let endDate = new Date(iso8601EndDate).toLocaleString("en-US");
|
||||||
for (let element of this.displayElement.querySelectorAll('.job-end-date')) {this.setElement(element, endDate);}
|
for (let element of this.displayElement.querySelectorAll('.job-end-date')) {this.setElement(element, endDate);}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user