Skip to content

Commit 0c0fe66

Browse files
authored
Merge pull request #38 from permaficus/development
Bump version v1.0.69 => v1.0.71
2 parents abd11e8 + d85724c commit 0c0fe66

File tree

3 files changed

+18
-14
lines changed

3 files changed

+18
-14
lines changed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "rexsync",
3-
"version": "1.0.69",
3+
"version": "1.0.71",
44
"main": "dist/cjs/src/index.js",
55
"module": "dist/esm/src/index.js",
66
"types": "dist/esm/src/index.d.ts",

src/helper/timeStamp.ts

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
export function timeStamp(): string {
2-
const date = new Date()
3-
const format = (num: number) => num.toString().padStart(2, '0')
2+
const date = new Date();
43

5-
const day = format(date.getDate())
6-
const month = format(date.getMonth() + 1)
7-
const year = date.getFullYear()
8-
const hours = format(date.getHours())
9-
const minutes = format(date.getMinutes())
10-
const seconds = format(date.getSeconds())
4+
// Format date and time using the machine's locale
5+
const options: Intl.DateTimeFormatOptions = {
6+
year: 'numeric',
7+
month: '2-digit',
8+
day: '2-digit',
9+
hour: '2-digit',
10+
minute: '2-digit',
11+
second: '2-digit',
12+
hour12: false, // Optional: Use 24-hour format
13+
};
1114

12-
// Return in mm/dd/yyyy hh:mm:ss format
13-
return `${month}/${day}/${year} ${hours}:${minutes}:${seconds}`
14-
}
15+
// Use locale
16+
const formattedDate = new Intl.DateTimeFormat(undefined, options).format(date);
17+
return formattedDate.replace(',', '').trim();
18+
}

0 commit comments

Comments
 (0)