ez-local-time
Advanced tools
Comparing version 0.0.1 to 0.0.2
38
app.js
'use strict' | ||
module.exports = function(dt, r){ | ||
if(dt === 'd'){ | ||
var d = new Date().toLocaleString('en-US', { timeZone: r }) | ||
d= d.substring(0, d.indexOf(',')) | ||
return d; | ||
}else if(dt === 't'){ | ||
var t = new Date().toLocaleString('en-US', { timeZone: r }) | ||
t= t.substring(t.indexOf(',')+2, t.length) | ||
return t; | ||
if(r === ''){ | ||
//no region specified, base off of runtime environment | ||
if(dt === 'd'){ | ||
//date only | ||
var d = new Date().toLocaleString('en-US', { timeZone: 'UTC' }) | ||
d= d.substring(0, d.indexOf(',')) | ||
return d; | ||
}else if(dt === 't'){ | ||
//time only | ||
}else{ | ||
//date and time | ||
} | ||
}else{ | ||
return new Date().toLocaleString('en-US', { timeZone: r }) | ||
//region is specified | ||
if(dt === 'd'){ | ||
//date only | ||
var d = new Date().toLocaleString('en-US', { timeZone: r }) | ||
d= d.substring(0, d.indexOf(',')) | ||
return d; | ||
}else if(dt === 't'){ | ||
//time only | ||
var t = new Date().toLocaleString('en-US', { timeZone: r }) | ||
t= t.substring(t.indexOf(',')+2, t.length) | ||
return t; | ||
}else{ | ||
//date and time | ||
return new Date().toLocaleString('en-US', { timeZone: r }) | ||
} | ||
} | ||
} |
{ | ||
"name": "ez-local-time", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Use raw Javascript to get local times and dates", | ||
@@ -5,0 +5,0 @@ "main": "app.js", |
@@ -1,1 +0,1 @@ | ||
# Local-Time | ||
# ez-local-time v1.0.0 |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1621
40