New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@socketsupply/components

Package Overview
Dependencies
Maintainers
7
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@socketsupply/components - npm Package Compare versions

Comparing version 14.0.4 to 14.0.5

2

package.json
{
"name": "@socketsupply/components",
"version": "14.0.4",
"version": "14.0.5",
"description": "Example components",

@@ -5,0 +5,0 @@ "type": "module",

@@ -207,5 +207,6 @@ import { Tonic } from '@socketsupply/tonic'

export class RelativeTime {
constructor (date, locale) {
constructor (date, locale, shortUnits) {
this.date = date
this.locale = locale
this.shortUnits = shortUnits
}

@@ -274,25 +275,25 @@

if (ms < 0) {
return formatRelativeTime(locale, 0, 'second')
return formatRelativeTime(locale, 0, 'second', this.shortUnits)
} else if (sec < 10) {
return formatRelativeTime(locale, 0, 'second')
return formatRelativeTime(locale, 0, 'second', this.shortUnits)
} else if (sec < 45) {
return formatRelativeTime(locale, -sec, 'second')
return formatRelativeTime(locale, -sec, 'second', this.shortUnits)
} else if (sec < 90) {
return formatRelativeTime(locale, -min, 'minute')
return formatRelativeTime(locale, -min, 'minute', this.shortUnits)
} else if (min < 45) {
return formatRelativeTime(locale, -min, 'minute')
return formatRelativeTime(locale, -min, 'minute', this.shortUnits)
} else if (min < 90) {
return formatRelativeTime(locale, -hr, 'hour')
return formatRelativeTime(locale, -hr, 'hour', this.shortUnits)
} else if (hr < 24) {
return formatRelativeTime(locale, -hr, 'hour')
return formatRelativeTime(locale, -hr, 'hour', this.shortUnits)
} else if (hr < 36) {
return formatRelativeTime(locale, -day, 'day')
return formatRelativeTime(locale, -day, 'day', this.shortUnits)
} else if (day < 30) {
return formatRelativeTime(locale, -day, 'day')
return formatRelativeTime(locale, -day, 'day', this.shortUnits)
} else if (month < 12) {
return formatRelativeTime(locale, -month, 'month')
return formatRelativeTime(locale, -month, 'month', this.shortUnits)
} else if (month < 18) {
return formatRelativeTime(locale, -year, 'year')
return formatRelativeTime(locale, -year, 'year', this.shortUnits)
} else {
return formatRelativeTime(locale, -year, 'year')
return formatRelativeTime(locale, -year, 'year', this.shortUnits)
}

@@ -315,25 +316,25 @@ }

if (month >= 18) {
return formatRelativeTime(locale, year, 'year')
return formatRelativeTime(locale, year, 'year', this.shortUnits)
} else if (month >= 12) {
return formatRelativeTime(locale, year, 'year')
return formatRelativeTime(locale, year, 'year', this.shortUnits)
} else if (day >= 45) {
return formatRelativeTime(locale, month, 'month')
return formatRelativeTime(locale, month, 'month', this.shortUnits)
} else if (day >= 30) {
return formatRelativeTime(locale, month, 'month')
return formatRelativeTime(locale, month, 'month', this.shortUnits)
} else if (hr >= 36) {
return formatRelativeTime(locale, day, 'day')
return formatRelativeTime(locale, day, 'day', this.shortUnits)
} else if (hr >= 24) {
return formatRelativeTime(locale, day, 'day')
return formatRelativeTime(locale, day, 'day', this.shortUnits)
} else if (min >= 90) {
return formatRelativeTime(locale, hr, 'hour')
return formatRelativeTime(locale, hr, 'hour', this.shortUnits)
} else if (min >= 45) {
return formatRelativeTime(locale, hr, 'hour')
return formatRelativeTime(locale, hr, 'hour', this.shortUnits)
} else if (sec >= 90) {
return formatRelativeTime(locale, min, 'minute')
return formatRelativeTime(locale, min, 'minute', this.shortUnits)
} else if (sec >= 45) {
return formatRelativeTime(locale, min, 'minute')
return formatRelativeTime(locale, min, 'minute', this.shortUnits)
} else if (sec >= 10) {
return formatRelativeTime(locale, sec, 'second')
return formatRelativeTime(locale, sec, 'second', this.shortUnits)
} else {
return formatRelativeTime(locale, 0, 'second')
return formatRelativeTime(locale, 0, 'second', this.shortUnits)
}

@@ -363,3 +364,3 @@ }

function formatRelativeTime (locale, value, unit) {
function formatRelativeTime (locale, value, unit, isShort) {
const formatter = makeRelativeFormat(locale, { numeric: 'auto' })

@@ -370,3 +371,3 @@

} else {
return formatEnRelativeTime(value, unit)
return formatEnRelativeTime(value, unit, isShort)
}

@@ -380,3 +381,3 @@ }

//
function formatEnRelativeTime (value, unit) {
function formatEnRelativeTime (value, unit, isShort) {
if (value === 0) {

@@ -388,3 +389,3 @@ switch (unit) {

case 'week':
return `this ${unit}`
return `this ${isShort ? unit[0] : unit}`
case 'day':

@@ -394,3 +395,3 @@ return 'today'

case 'minute':
return `in 0 ${unit}s`
return `in 0 ${isShort ? unit[0] : unit + 's'}`
case 'second':

@@ -405,3 +406,3 @@ return 'now'

case 'week':
return `next ${unit}`
return `next ${isShort ? unit[0] : unit}`
case 'day':

@@ -412,3 +413,3 @@ return 'tomorrow'

case 'second':
return `in 1 ${unit}`
return `in 1 ${isShort ? unit[0] : unit}`
}

@@ -421,3 +422,3 @@ } else if (value === -1) {

case 'week':
return `last ${unit}`
return `last ${isShort ? unit[0] : unit}`
case 'day':

@@ -428,3 +429,3 @@ return 'yesterday'

case 'second':
return `1 ${unit} ago`
return `1 ${isShort ? unit[0] : unit} ago`
}

@@ -441,3 +442,3 @@ } else if (value > 1) {

case 'second':
return `in ${value} ${unit}s`
return `in ${value} ${isShort ? unit[0] : unit + 's'}`
}

@@ -454,3 +455,3 @@ } else if (value < -1) {

case 'second':
return `${-value} ${unit}s ago`
return `${-value} ${isShort ? unit[0] : unit + 's'} ago`
}

@@ -468,3 +469,7 @@ }

if (typeof date === 'string') {
date = this.props.date = new Date(+this.props.date)
date = this.props.date =
// If its a unix timestamp, pass it as a number
/^[0-9]+$/.test(this.props.date)
? new Date(+this.props.date)
: new Date(this.props.date)
}

@@ -490,3 +495,3 @@

const t = new RelativeTime(date, locale)
const t = new RelativeTime(date, locale, this.props.shortUnits)
return t.toString()

@@ -493,0 +498,0 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc