Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

stockshark-util

Package Overview
Dependencies
Maintainers
0
Versions
444
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stockshark-util - npm Package Compare versions

Comparing version 1.0.442 to 1.0.443

2

package.json
{
"name": "stockshark-util",
"version": "1.0.442",
"version": "1.0.443",
"description": "util",

@@ -5,0 +5,0 @@ "main": "./src/index.js",

const moment = require("moment-timezone")
const intervals = require("./consts/intervals")
const util = require("./util")

@@ -114,2 +115,23 @@ //Summer (EDT), UTC -4 currently in use

toHumanizedElapsedTime(start) {
if (!util.isNumber(start)) return ""
return moment().subtract(moment().diff(start, "seconds"), "seconds").fromNow()
}
toHumanizedDuration(seconds) {
if (!util.isNumber(seconds)) return ""
const duration = moment.duration(seconds, "seconds")
if (duration.asSeconds() < 60) {
return Math.round(duration.asSeconds()) + " seconds"
} else if (duration.asMinutes() < 60) {
return Math.round(duration.asMinutes()) + " minutes"
} else if (duration.asHours() < 24) {
return duration.asHours().toFixed(1) + " hours"
} else {
return duration.asDays().toFixed(1) + " days"
}
}
nowET() {

@@ -116,0 +138,0 @@ return this.nowETDate().valueOf()

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