Skip to content

Commit d517608

Browse files
committed
Making date-time component relative time a bit fuzzy around "now", so it does not create future references to past events if the client's clock is a bit off.
1 parent 268913f commit d517608

File tree

60 files changed

+121
-117
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+121
-117
lines changed

src/components/Assignments/Assignment/AssignmentDetails/AssignmentDetails.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ const AssignmentDetails = ({
9999
</Explanation>
100100
</th>
101101
<td>
102-
<DateTime unixts={createdAt} showRelative />
102+
<DateTime unixTs={createdAt} showRelative />
103103
</td>
104104
</tr>
105105
)}
@@ -113,7 +113,7 @@ const AssignmentDetails = ({
113113
<FormattedMessage id="app.assignment.visibleFrom" defaultMessage="Visible from" />:
114114
</th>
115115
<td>
116-
<DateTime unixts={visibleFrom} showRelative />
116+
<DateTime unixTs={visibleFrom} showRelative />
117117
</td>
118118
</tr>
119119
)}
@@ -155,11 +155,11 @@ const AssignmentDetails = ({
155155
)}
156156
</th>
157157
<td>
158-
<DateTime unixts={firstDeadline} isDeadline showRelative />
158+
<DateTime unixTs={firstDeadline} isDeadline showRelative />
159159
{allowSecondDeadline && (
160160
<>
161161
<br />
162-
<DateTime unixts={secondDeadline} isDeadline showRelative />
162+
<DateTime unixTs={secondDeadline} isDeadline showRelative />
163163
</>
164164
)}
165165
</td>

src/components/Assignments/Assignment/AssignmentSync/AssignmentSync.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const AssignmentSync = ({ syncInfo, exerciseSync }) => {
2525
id="app.assignment.syncRequired"
2626
defaultMessage="Exercise was updated at <strong>{exerciseUpdated}</strong>, but the assignment was synchronized with the exercise at <strong>{assignmentUpdated}</strong>!"
2727
values={{
28-
exerciseUpdated: <DateTime unixts={syncInfo.updatedAt.exercise} emptyPlaceholder="??" />,
29-
assignmentUpdated: <DateTime unixts={syncInfo.updatedAt.assignment} emptyPlaceholder="??" />,
28+
exerciseUpdated: <DateTime unixTs={syncInfo.updatedAt.exercise} emptyPlaceholder="??" />,
29+
assignmentUpdated: <DateTime unixTs={syncInfo.updatedAt.assignment} emptyPlaceholder="??" />,
3030
strong: contents => <strong>{contents}</strong>,
3131
}}
3232
/>

src/components/Assignments/Assignment/AssignmentSyncIcon/AssignmentSyncIcon.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ const AssignmentSyncIcon = ({ id, syncInfo, ...props }) => {
2525
id="app.assignment.syncRequired"
2626
defaultMessage="Exercise was updated at <strong>{exerciseUpdated}</strong>, but the assignment was synchronized with the exercise at <strong>{assignmentUpdated}</strong>!"
2727
values={{
28-
exerciseUpdated: <DateTime unixts={syncInfo.updatedAt.exercise} emptyPlaceholder="??" />,
29-
assignmentUpdated: <DateTime unixts={syncInfo.updatedAt.assignment} emptyPlaceholder="??" />,
28+
exerciseUpdated: <DateTime unixTs={syncInfo.updatedAt.exercise} emptyPlaceholder="??" />,
29+
assignmentUpdated: <DateTime unixTs={syncInfo.updatedAt.assignment} emptyPlaceholder="??" />,
3030
strong: contents => <strong>{contents}</strong>,
3131
}}
3232
/>

src/components/Assignments/Assignment/AssignmentTableRow/AssignmentTableRow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ const AssignmentTableRow = ({
128128
</td>
129129
)}
130130
<td className="text-nowrap">
131-
<DateTime unixts={firstDeadline} isDeadline />
131+
<DateTime unixTs={firstDeadline} isDeadline />
132132
</td>
133133

134134
{showSecondDeadline && (
135135
<td className="text-nowrap">
136-
<DateTime unixts={allowSecondDeadline ? secondDeadline : null} isDeadline />
136+
<DateTime unixTs={allowSecondDeadline ? secondDeadline : null} isDeadline />
137137
</td>
138138
)}
139139

src/components/Assignments/ShadowAssignment/ShadowAssignmentDetail/ShadowAssignmentDetail.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const ShadowAssignmentDetail = ({
4848
<FormattedMessage id="generic.createdAt" defaultMessage="Created at" />:
4949
</th>
5050
<td>
51-
<DateTime unixts={createdAt} />
51+
<DateTime unixTs={createdAt} />
5252
</td>
5353
</tr>
5454

@@ -66,7 +66,7 @@ const ShadowAssignmentDetail = ({
6666
</Explanation>
6767
</th>
6868
<td>
69-
<DateTime unixts={deadline} isDeadline />
69+
<DateTime unixTs={deadline} isDeadline />
7070
</td>
7171
</tr>
7272

src/components/Assignments/ShadowAssignment/ShadowAssignmentsTable/ShadowAssignmentsTableRow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,11 @@ const ShadowAssignmentsTableRow = ({
4848
</td>
4949

5050
<td className="text-nowrap">
51-
<DateTime unixts={createdAt} />
51+
<DateTime unixTs={createdAt} />
5252
</td>
5353

5454
<td className="text-nowrap">
55-
<DateTime unixts={deadline} isDeadline />
55+
<DateTime unixTs={deadline} isDeadline />
5656
</td>
5757

5858
<td className="text-center">

src/components/Assignments/ShadowAssignmentPointsDetail/ShadowAssignmentPointsDetail.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ const ShadowAssignmentPointsDetail = ({ points = null, awardedAt = null, authorI
4343
<th>
4444
<FormattedMessage id="app.shadowAssignmentPointsDetail.awardedAt" defaultMessage="Awarded at" />:
4545
</th>
46-
<td>{awardedAt !== null ? <DateTime unixts={awardedAt} showRelative /> : <span>&mdash;</span>}</td>
46+
<td>{awardedAt !== null ? <DateTime unixTs={awardedAt} showRelative /> : <span>&mdash;</span>}</td>
4747
</tr>
4848
)}
4949

src/components/Assignments/ShadowAssignmentPointsTable/ShadowAssignmentPointsTable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,7 @@ class ShadowAssignmentPointsTable extends Component {
197197
/>
198198
</td>
199199
<td className="text-center text-nowrap">{points !== null ? points : <span>&mdash;</span>}</td>
200-
<td>{awardedAt && <DateTime unixts={awardedAt} showRelative />}</td>
200+
<td>{awardedAt && <DateTime unixTs={awardedAt} showRelative />}</td>
201201
<td>{safeGet(studentPoints, [student.id, 'note'], null)}</td>
202202
<td className="shrink-col text-nowrap text-end">
203203
{points === null ? (

src/components/Assignments/SolutionsTable/SolutionsTableRow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const SolutionsTableRow = ({
8989
</td>
9090

9191
<td className="text-nowrap align-middle">
92-
<DateTime unixts={createdAt} showOverlay overlayTooltipId={`datetime-${id}`} />
92+
<DateTime unixTs={createdAt} showOverlay overlayTooltipId={`datetime-${id}`} />
9393
</td>
9494

9595
<td className="text-center text-nowrap align-middle">

src/components/AsyncJobs/AsyncJobsList/AsyncJobsList.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ const AsyncJobsList = ({ asyncJobs, abort = null, links: { ASSIGNMENT_DETAIL_URI
6363
)}
6464
</td>
6565
<td className="small text-nowrap align-baseline">
66-
<DateTime unixts={job.createdAt} showDate={false} showSeconds showOverlay />
66+
<DateTime unixTs={job.createdAt} showDate={false} showSeconds showOverlay />
6767
</td>
6868
<td className="small text-nowrap align-baseline">
69-
<DateTime unixts={job.scheduledAt} emptyPlaceholder="-" />
69+
<DateTime unixTs={job.scheduledAt} emptyPlaceholder="-" />
7070
</td>
7171
<td className="small text-nowrap align-baseline">
7272
{job.startedAt ? (
@@ -78,7 +78,7 @@ const AsyncJobsList = ({ asyncJobs, abort = null, links: { ASSIGNMENT_DETAIL_URI
7878
<FormattedMessage id="app.asyncJobs.list.processInfo" defaultMessage="Processing info" />
7979
</Popover.Header>
8080
<Popover.Body>
81-
<DateTime unixts={job.startedAt} showSeconds showRelative />
81+
<DateTime unixTs={job.startedAt} showSeconds showRelative />
8282
<br />
8383
<FormattedMessage id="app.asyncJobs.list.worker" defaultMessage="Worker" />:{' '}
8484
<code>{job.workerId}</code>
@@ -89,7 +89,7 @@ const AsyncJobsList = ({ asyncJobs, abort = null, links: { ASSIGNMENT_DETAIL_URI
8989
}>
9090
{
9191
<span>
92-
<DateTime unixts={job.startedAt} showDate={false} showSeconds />
92+
<DateTime unixTs={job.startedAt} showDate={false} showSeconds />
9393
</span>
9494
}
9595
</OverlayTrigger>
@@ -98,7 +98,7 @@ const AsyncJobsList = ({ asyncJobs, abort = null, links: { ASSIGNMENT_DETAIL_URI
9898
)}
9999
</td>
100100
<td className="small text-nowrap align-baseline">
101-
<DateTime unixts={job.finishedAt} emptyPlaceholder="-" showDate={false} showSeconds showOverlay />
101+
<DateTime unixTs={job.finishedAt} emptyPlaceholder="-" showDate={false} showSeconds showOverlay />
102102
</td>
103103
<td className="align-baseline">
104104
{job.arguments && Object.keys(job.arguments).length > 0 ? (

0 commit comments

Comments
 (0)