Correct behavior of date formatting

This commit is contained in:
Dane Everitt 2019-08-05 22:22:31 -07:00
parent e23f609e7a
commit 1769d191d2
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
2 changed files with 3 additions and 3 deletions

View file

@ -38,8 +38,8 @@ class FileObjectTransformer extends BaseDaemonTransformer
'is_symlink' => Arr::get($item, 'symlink', false),
'is_editable' => in_array(Arr::get($item, 'mime', ''), $this->editable),
'mimetype' => Arr::get($item, 'mime'),
'created_at' => Carbon::parse(explode(' ', Arr::get($item, 'created', ''))[0] ?? '')->toIso8601String(),
'modified_at' => Carbon::parse(explode(' ', Arr::get($item, 'modified', ''))[0] ?? '')->toIso8601String(),
'created_at' => Carbon::parse(Arr::get($item, 'created', ''))->toIso8601String(),
'modified_at' => Carbon::parse(Arr::get($item, 'modified', ''))->toIso8601String(),
];
}

View file

@ -62,7 +62,7 @@ export default ({ file }: { file: FileObject }) => {
{Math.abs(differenceInHours(file.modifiedAt, new Date())) > 48 ?
format(file.modifiedAt, 'MMM Do, YYYY h:mma')
:
distanceInWordsToNow(file.modifiedAt, { includeSeconds: true })
distanceInWordsToNow(file.modifiedAt, { addSuffix: true })
}
</div>
</a>