goldob / hh-mm-ss Goto Github PK
View Code? Open in Web Editor NEW:watch: Simple hh:mm:ss time formatting utility for use in media players
Home Page: https://www.npmjs.com/package/hh-mm-ss
License: MIT License
:watch: Simple hh:mm:ss time formatting utility for use in media players
Home Page: https://www.npmjs.com/package/hh-mm-ss
License: MIT License
The following features are requested, along with test cases to support them:
fromMs()
, e.g. return 2:30
instead of 02:30
with input 150000
toMs()
accept input without leading zerosI am working on a project and when I try to package it with reactjs and webpack it spits out an error.
"Creating an optimized production build...Failed to compile.
Failed to minify the code from this file:
./node_modules/hh-mm-ss/index.js:4
Read more here: http://bit.ly/2tRViJ9 "
It would be nice to support hh:mm format, I have a timing app where I don't want to show seconds ticking over as it's distracting
When using this
import * as TimeFormat from 'hh-mm-ss';
console.log(TimeFormat.fromS(process.uptime(), 'hh:mm:ss'))
I get
(node:8264) UnhandledPromiseRejectionWarning: TypeError: TimeFormat.fromS is not a function
at Object.run (file:///C:/Users/zz/Documents/GitHub/nottriz/TwitchCMCB-ALPHA/commands/debug.js:11:110)
at Module.onMessage (file:///C:/Users/zz/Documents/GitHub/nottriz/TwitchCMCB-ALPHA/events/onMessage.js:40:17)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:8264) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:8264) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Just went to use this for the first time and hit this error:
REDACTED/node_modules/hh-mm-ss/index.js:23
function fromMs (ms, format = 'mm:ss') {
^
SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (REDACTED/workers/app.js:9:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
I have the following:
export const formatSecondsToStopWatch = (seconds, displayFormat = 'hh:mm:ss') => {
console.log('input', seconds)
console.log('displayFormat', displayFormat)
let test = timeFormat.fromS(seconds, displayFormat)
console.log('output', test)
return test
}
formatSecondsToStopWatch(2, 'hh:mm')
formatSecondsToStopWatch(2)
which outputs
input 2
stopwatch.js:59 displayFormat hh:mm
stopwatch.js:61 output 00:00:02
stopwatch.js:58 input 2
stopwatch.js:59 displayFormat hh:mm:ss
stopwatch.js:61 output 00:00:02
When I expecting the first output to be 00:00
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.