Skip to content

Commit b91d260

Browse files
time() fix intl issue
1 parent 82beee3 commit b91d260

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030

3131
## The Systeminformation Project
3232

33-
This is amazing. Started as a small project just for myself, it now has > 17,000
34-
lines of code, > 650 versions published, up to 8 mio downloads per month, > 350
33+
This is amazing. Started as a small project just for myself, it now has > 18,000
34+
lines of code, > 700 versions published, up to 9 mio downloads per month, > 380
3535
mio downloads overall. Top 10 NPM ranking for backend packages. Thank you to all
3636
who contributed to this project!
3737

docs/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@
204204
</div>
205205
<div class="row number-section">
206206
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
207-
<div class="numbers">18,504</div>
207+
<div class="numbers">18,542</div>
208208
<div class="title">Lines of code</div>
209209
</div>
210210
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
211211
<div id="downloads" class="numbers">...</div>
212212
<div class="title">Downloads last month</div>
213213
</div>
214214
<div class="col-xl-4 col-lg-4 col-md-4 col-12">
215-
<div class="numbers">865</div>
215+
<div class="numbers">867</div>
216216
<div class="title">Dependents</div>
217217
</div>
218218
</div>

lib/osinfo.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,17 @@ const _sunos = (_platform === 'sunos');
3434

3535
function time() {
3636
let t = new Date().toString().split(' ');
37+
let timezoneName = '';
38+
try {
39+
timezoneName = Intl.DateTimeFormat().resolvedOptions().timeZone;
40+
} catch {
41+
timezoneName = (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : '';
42+
}
3743
const result = {
3844
current: Date.now(),
3945
uptime: os.uptime(),
4046
timezone: (t.length >= 7) ? t[5] : '',
41-
timezoneName: Intl ? Intl.DateTimeFormat().resolvedOptions().timeZone : (t.length >= 7) ? t.slice(6).join(' ').replace(/\(/g, '').replace(/\)/g, '') : ''
47+
timezoneName
4248
};
4349
if (_darwin || _linux) {
4450
try {

0 commit comments

Comments
 (0)