mirror of
https://gitlab.ub.uni-bielefeld.de/sfb1288inf/nopaque.git
synced 2024-12-24 02:24:20 +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():
|
||||
continue
|
||||
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):
|
||||
new_value = new_value.timestamp()
|
||||
new_value = new_value.isoformat()
|
||||
jsonpatch.append(
|
||||
{
|
||||
'op': 'replace',
|
||||
|
@ -157,8 +157,8 @@ class User(UserMixin, db.Model):
|
||||
'role_id': self.role_id,
|
||||
'confirmed': self.confirmed,
|
||||
'email': self.email,
|
||||
'last_seen': self.last_seen.timestamp(),
|
||||
'member_since': self.member_since.timestamp(),
|
||||
'last_seen': self.last_seen.isoformat(),
|
||||
'member_since': self.member_since.isoformat(),
|
||||
'settings': {'dark_mode': self.setting_dark_mode,
|
||||
'job_status_mail_notifications':
|
||||
self.setting_job_status_mail_notifications,
|
||||
@ -433,9 +433,9 @@ class Job(db.Model):
|
||||
'url': self.url,
|
||||
'id': self.id,
|
||||
'user_id': self.user_id,
|
||||
'creation_date': self.creation_date.timestamp(),
|
||||
'creation_date': self.creation_date.isoformat(),
|
||||
'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_args': self.service_args,
|
||||
'service_version': self.service_version,
|
||||
@ -557,11 +557,11 @@ class Corpus(db.Model):
|
||||
'url': self.url,
|
||||
'id': self.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,
|
||||
'description': self.description,
|
||||
'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,
|
||||
'title': self.title,
|
||||
}
|
||||
|
@ -91,13 +91,13 @@ class CorpusDisplay extends RessourceDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
setCreationDate(creationDateTimestamp) {
|
||||
let creationDate = new Date(creationDateTimestamp * 1000).toLocaleString("en-US");
|
||||
setCreationDate(iso8601CreationDate) {
|
||||
let creationDate = new Date(iso8601CreationDate).toLocaleString("en-US");
|
||||
for (let element of this.displayElement.querySelectorAll('.corpus-creation-date')) {this.setElement(element, creationDate);}
|
||||
}
|
||||
|
||||
setLastEditedDate(endDateTimestamp) {
|
||||
let endDate = new Date(endDateTimestamp * 1000).toLocaleString("en-US");
|
||||
setLastEditedDate(iso8601LastEditedDate) {
|
||||
let endDate = new Date(iso8601LastEditedDate).toLocaleString("en-US");
|
||||
for (let element of this.displayElement.querySelectorAll('.corpus-end-date')) {this.setElement(element, endDate);}
|
||||
}
|
||||
}
|
||||
|
@ -63,13 +63,13 @@ class JobDisplay extends RessourceDisplay {
|
||||
}
|
||||
}
|
||||
|
||||
setCreationDate(creationDateTimestamp) {
|
||||
let creationDate = new Date(creationDateTimestamp * 1000).toLocaleString("en-US");
|
||||
setCreationDate(iso8601CreationDate) {
|
||||
let creationDate = new Date(iso8601CreationDate).toLocaleString("en-US");
|
||||
for (let element of this.displayElement.querySelectorAll('.job-creation-date')) {this.setElement(element, creationDate);}
|
||||
}
|
||||
|
||||
setEndDate(endDateTimestamp) {
|
||||
let endDate = new Date(endDateTimestamp * 1000).toLocaleString("en-US");
|
||||
setEndDate(iso8601EndDate) {
|
||||
let endDate = new Date(iso8601EndDate).toLocaleString("en-US");
|
||||
for (let element of this.displayElement.querySelectorAll('.job-end-date')) {this.setElement(element, endDate);}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user