mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-04-21 07:32:02 +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 Notification = ({ className, id, type, name, logo, poster, season, episode, released, posterThumbnail, onClick }) => {
|
||||||
const [aLogo, setALogo] = React.useState(logo);
|
const [aLogo, setALogo] = React.useState(logo);
|
||||||
|
const daysAgo = Math.floor(Math.abs((Date.now() - released) / (24 * 60 * 60 * 1000)));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Button className={classnames(className, styles['notification-container'])} title={typeof name === 'string' && name.length > 0 ? name : id} data-id={id} onClick={onClick}>
|
<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()) ?
|
released instanceof Date && !isNaN(released.getTime()) ?
|
||||||
<div className={styles['released-container']}>
|
<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>
|
</div>
|
||||||
:
|
:
|
||||||
null
|
null
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue