time() fix intl issue
This commit is contained in:
parent
82beee3dd4
commit
b91d260b23
@ -30,8 +30,8 @@
|
|||||||
|
|
||||||
## The Systeminformation Project
|
## The Systeminformation Project
|
||||||
|
|
||||||
This is amazing. Started as a small project just for myself, it now has > 17,000
|
This is amazing. Started as a small project just for myself, it now has > 18,000
|
||||||
lines of code, > 650 versions published, up to 8 mio downloads per month, > 350
|
lines of code, > 700 versions published, up to 9 mio downloads per month, > 380
|
||||||
mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
|
mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
|
||||||
who contributed to this project!
|
who contributed to this project!
|
||||||
|
|
||||||
|
|||||||
@ -204,7 +204,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="row number-section">
|
<div class="row number-section">
|
||||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||||
<div class="numbers">18,504</div>
|
<div class="numbers">18,542</div>
|
||||||
<div class="title">Lines of code</div>
|
<div class="title">Lines of code</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||||
@ -212,7 +212,7 @@
|
|||||||
<div class="title">Downloads last month</div>
|
<div class="title">Downloads last month</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
|
||||||
<div class="numbers">865</div>
|
<div class="numbers">867</div>
|
||||||
<div class="title">Dependents</div>
|
<div class="title">Dependents</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -34,11 +34,17 @@ const _sunos = (_platform === 'sunos');
|
|||||||
|
|
||||||
function time() {
|
function time() {
|
||||||
let t = new Date().toString().split(' ');
|
let t = new Date().toString().split(' ');
|
||||||
|
let timezoneName = '';
|
||||||
|
try {
|
||||||
|
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
||||||
|
} catch {
|
||||||
|
timezoneName = (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '';
|
||||||
|
}
|
||||||
const result = {
|
const result = {
|
||||||
current: Date.now(),
|
current: Date.now(),
|
||||||
uptime: os.uptime(),
|
uptime: os.uptime(),
|
||||||
timezone: (t.length >= 7) ? t[5] : '',
|
timezone: (t.length >= 7) ? t[5] : '',
|
||||||
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
|
timezoneName
|
||||||
};
|
};
|
||||||
if (_darwin || _linux) {
|
if (_darwin || _linux) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user