| 371 | } |
| 372 | |
| 373 | export function timeToString(time: DurationFormat): string { |
| 374 | let output = ''; |
| 375 | |
| 376 | if (time.years) { |
| 377 | if (time.years === 1) output += ` ${time.years} ${api.storage.lang('bookmarksItem_Year')}`; |
| 378 | else output += ` ${time.years} ${api.storage.lang('bookmarksItem_Years')}`; |
| 379 | } |
| 380 | if (time.days) { |
| 381 | if (time.days === 1) output += ` ${time.days} ${api.storage.lang('bookmarksItem_Day')}`; |
| 382 | else output += ` ${time.days} ${api.storage.lang('bookmarksItem_Days')}`; |
| 383 | } |
| 384 | if (time.hours) { |
| 385 | if (time.hours === 1) output += ` ${time.hours} ${api.storage.lang('bookmarksItem_Hour')}`; |
| 386 | else output += ` ${time.hours} ${api.storage.lang('bookmarksItem_Hours')}`; |
| 387 | } |
| 388 | if (time.minutes) { |
| 389 | if (time.minutes === 1) output += ` ${time.minutes} ${api.storage.lang('bookmarksItem_min')}`; |
| 390 | else output += ` ${time.minutes} ${api.storage.lang('bookmarksItem_mins')}`; |
| 391 | } |
| 392 | if (time.seconds) { |
| 393 | if (time.seconds === 1) output += ` ${time.seconds} ${api.storage.lang('bookmarksItem_sec')}`; |
| 394 | else output += ` ${time.seconds} ${api.storage.lang('bookmarksItem_secs')}`; |
| 395 | } |
| 396 | |
| 397 | return output.trim(); |
| 398 | } |
| 399 | |
| 400 | export function isValidDate(date: Date | string | number | null | undefined): boolean { |
| 401 | if (!date) return false; |