Fix time?
This commit is contained in:
parent
e340582c7a
commit
d04746a5d8
2
index.js
2
index.js
|
@ -12,7 +12,7 @@ app.get('/time.php', (req, res) => {
|
||||||
try {
|
try {
|
||||||
const date = new Date();
|
const date = new Date();
|
||||||
const options = { timeZone: tz, hour12: false };
|
const options = { timeZone: tz, hour12: false };
|
||||||
const pad = n => n.toString().padStart(2, '0');
|
const pad = n => n.toString().padStart(2, ' ');
|
||||||
const year = date.toLocaleString('en-GB', { ...options, year: 'numeric' });
|
const year = date.toLocaleString('en-GB', { ...options, year: 'numeric' });
|
||||||
const month = pad(date.toLocaleString('en-GB', { ...options, month: '2-digit' }));
|
const month = pad(date.toLocaleString('en-GB', { ...options, month: '2-digit' }));
|
||||||
const day = pad(date.toLocaleString('en-GB', { ...options, day: '2-digit' }));
|
const day = pad(date.toLocaleString('en-GB', { ...options, day: '2-digit' }));
|
||||||
|
|
Loading…
Reference in a new issue