mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-05 04:19:55 +00:00
handle the case for today notification
This commit is contained in:
parent
24424ad7e0
commit
3973271d95
1 changed files with 2 additions and 1 deletions
|
|
@ -16,6 +16,7 @@ const ICON_FOR_TYPE = Object.assign(Object.create(null), {
|
|||
|
||||
const Notification = ({ className, id, type, name, logo, poster, season, episode, released, posterThumbnail, onClick }) => {
|
||||
const [aLogo, setALogo] = React.useState(logo);
|
||||
const daysAgo = Math.floor(Math.abs((Date.now() - released) / (24 * 60 * 60 * 1000)));
|
||||
|
||||
return (
|
||||
<Button className={classnames(className, styles['notification-container'])} title={typeof name === 'string' && name.length > 0 ? name : id} data-id={id} onClick={onClick}>
|
||||
|
|
@ -45,7 +46,7 @@ const Notification = ({ className, id, type, name, logo, poster, season, episode
|
|||
{
|
||||
released instanceof Date && !isNaN(released.getTime()) ?
|
||||
<div className={styles['released-container']}>
|
||||
{Math.floor(Math.abs((Date.now() - released) / (24 * 60 * 60 * 1000))) + ' days ago'}
|
||||
{daysAgo === 0 ? 'today' : daysAgo + ' days ago'}
|
||||
</div>
|
||||
:
|
||||
null
|
||||
|
|
|
|||
Loading…
Reference in a new issue