File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 1+ const { Workspace } = require ( '../index.js' ) ;
2+
3+
4+ Workspace . newF ( "parseTime" , function ( string ) {
5+ if ( typeof string != "string" ) {
6+ return parseFloat ( string ) ;
7+ }
8+ let t = string . split ( "" ) ;
9+ let thing = t . pop ( ) ;
10+
11+ if ( thing == "s" ) { return parseFloat ( t . join ( "" ) ) ; }
12+ else if ( thing == "ms" ) { return parseFloat ( t . join ( "" ) ) * 1000 ; }
13+ else if ( thing == "m" ) { return parseFloat ( t . join ( "" ) ) * 60 ; }
14+ else if ( thing == "h" ) { return parseFloat ( t . join ( "" ) ) * 60 * 60 ; }
15+ else if ( thing == "d" ) { return parseFloat ( t . join ( "" ) ) * 60 * 60 * 24 ; }
16+ else if ( thing == "w" ) { return parseFloat ( t . join ( "" ) ) * 60 * 60 * 24 * 7 ; }
17+ else if ( thing == "y" ) { return parseFloat ( t . join ( "" ) ) * 60 * 60 * 24 * 365 ; }
18+ else { return parseFloat ( string ) ; }
19+ } ) ;
You can’t perform that action at this time.
0 commit comments