clockey 1.0.2 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -58
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -56,64 +56,64 @@ Below are grouped, easy-to-read tables for the package exports. Each table shows
|
|
|
56
56
|
|
|
57
57
|
### ⏱️ Time helpers
|
|
58
58
|
|
|
59
|
-
| Name | Example
|
|
60
|
-
| --------------------- |
|
|
61
|
-
| `formatCurrentTime()` | `formatCurrentTime()` |
|
|
62
|
-
| `currentHour()` | `currentHour()`
|
|
63
|
-
| `currentMinute()` | `currentMinute()`
|
|
64
|
-
| `currentSecond()` | `currentSecond()`
|
|
65
|
-
| `currentHour24Str()` | `currentHour24Str()`
|
|
66
|
-
| `currentHour12Str()` | `currentHour12Str()`
|
|
67
|
-
| `currentMinuteStr()` | `currentMinuteStr()`
|
|
68
|
-
| `currentSecondStr()` | `currentSecondStr()`
|
|
69
|
-
| `currentPeriod()` | `currentPeriod()`
|
|
59
|
+
| Name | Example Usage | Output Format | Example Data |
|
|
60
|
+
| --------------------- | ----------------------------------- | ---------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
61
|
+
| `formatCurrentTime()` | `const time = formatCurrentTime();` | `{ hr24, hr12, min, sec, period, hr24Str, hr12Str, minStr, secStr, timeAsString24, timeAsString12 }` | `{ hr24: 9, hr12: 9, min: 5, sec: 7, period: 'AM', hr24Str: '09', hr12Str: '09', minStr: '05', secStr: '07', timeAsString24: '09:05:07', timeAsString12: '09:05:07 AM' }` |
|
|
62
|
+
| `currentHour()` | `const hr = currentHour();` | `{ hour24, hour12, hour24Str, hour12Str }` | `{ hour24: 9, hour12: 9, hour24Str: '09', hour12Str: '09' }` |
|
|
63
|
+
| `currentMinute()` | `const min = currentMinute();` | `{ minute, minuteStr }` | `{ minute: 5, minuteStr: '05' }` |
|
|
64
|
+
| `currentSecond()` | `const sec = currentSecond();` | `{ second, secondStr }` | `{ second: 7, secondStr: '07' }` |
|
|
65
|
+
| `currentHour24Str()` | `const h = currentHour24Str();` | `string` | `'09'` |
|
|
66
|
+
| `currentHour12Str()` | `const h = currentHour12Str();` | `string` | `'09'` |
|
|
67
|
+
| `currentMinuteStr()` | `const m = currentMinuteStr();` | `string` | `'05'` |
|
|
68
|
+
| `currentSecondStr()` | `const s = currentSecondStr();` | `string` | `'07'` |
|
|
69
|
+
| `currentPeriod()` | `const p = currentPeriod();` | `{ period }` | `{ period: 'AM' }` |
|
|
70
70
|
|
|
71
71
|
### 🧾 Time response helpers
|
|
72
72
|
|
|
73
|
-
| Name | Example
|
|
74
|
-
| ------------------------------- |
|
|
75
|
-
| `getCurrentTime()` | `getCurrentTime()`
|
|
76
|
-
| `getCurrentTimeResponse()` | `getCurrentTimeResponse()
|
|
77
|
-
| `getCurrentHr()` | `getCurrentHr()
|
|
78
|
-
| `getCurrenHrResponse()` | `getCurrenHrResponse()
|
|
79
|
-
| `getCurrentMinute()` | `getCurrentMinute()
|
|
80
|
-
| `getCurrentMinuteResponse()` | `getCurrentMinuteResponse()
|
|
81
|
-
| `getCurrentSecond()` | `getCurrentSecond()
|
|
82
|
-
| `getCurrentSecondResponse()` | `getCurrentSecondResponse()
|
|
83
|
-
| `getCurrentHour24Str()` | `getCurrentHour24Str()
|
|
84
|
-
| `getCurrentHour24StrResponse()` | `getCurrentHour24StrResponse()` | `{ success, code, msg, value }`
|
|
85
|
-
| `getCurrentHour12Str()` | `getCurrentHour12Str()
|
|
86
|
-
| `getCurrentHour12StrResponse()` | `getCurrentHour12StrResponse()` | `{ success, code, msg, value }`
|
|
87
|
-
| `getCurrentMinuteStr()` | `getCurrentMinuteStr()
|
|
88
|
-
| `getCurrentMinuteStrResponse()` | `getCurrentMinuteStrResponse()` | `{ success, code, msg, value }`
|
|
89
|
-
| `getCurrentSecondStr()` | `getCurrentSecondStr()
|
|
90
|
-
| `getCurrentSecondStrResponse()` | `getCurrentSecondStrResponse()` | `{ success, code, msg, value }`
|
|
91
|
-
| `getCurrentPeriod()` | `getCurrentPeriod()
|
|
92
|
-
| `getCurrentPeriodResponse()` | `getCurrentPeriodResponse()
|
|
73
|
+
| Name | Example Usage | Output Format | Example Data |
|
|
74
|
+
| ------------------------------- | ------------------------------------------ | ------------------------------------ | ----------------------------------------------------------------------------------------- |
|
|
75
|
+
| `getCurrentTime()` | `const data = getCurrentTime();` | `{ timeAsString12, timeAsString24 }` | `{ timeAsString12: '09:05:07 AM', timeAsString24: '09:05:07' }` |
|
|
76
|
+
| `getCurrentTimeResponse()` | `res.json(getCurrentTimeResponse());` | `{ success, code, msg, data }` | `{ success: true, code: 200, msg: 'Current time fetched successfully', data: {...} }` |
|
|
77
|
+
| `getCurrentHr()` | `const hr = getCurrentHr();` | returns `currentHour()` | `{ hour24: 9, hour12: 9, hour24Str: '09', hour12Str: '09' }` |
|
|
78
|
+
| `getCurrenHrResponse()` | `res.json(getCurrenHrResponse());` | `{ success, code, msg, hour }` | `{ success: true, code: 200, msg: 'Current hour fetched successfully', hour: {...} }` |
|
|
79
|
+
| `getCurrentMinute()` | `const min = getCurrentMinute();` | returns `currentMinute()` | `{ minute: 5, minuteStr: '05' }` |
|
|
80
|
+
| `getCurrentMinuteResponse()` | `res.json(getCurrentMinuteResponse());` | `{ success, code, msg, minute }` | `{ success: true, code: 200, msg: 'Current minute fetched successfully', minute: {...} }` |
|
|
81
|
+
| `getCurrentSecond()` | `const sec = getCurrentSecond();` | returns `currentSecond()` | `{ second: 7, secondStr: '07' }` |
|
|
82
|
+
| `getCurrentSecondResponse()` | `res.json(getCurrentSecondResponse());` | `{ success, code, msg, second }` | `{ success: true, code: 200, msg: 'Current second fetched successfully', second: {...} }` |
|
|
83
|
+
| `getCurrentHour24Str()` | `const h = getCurrentHour24Str();` | `string` | `'09'` |
|
|
84
|
+
| `getCurrentHour24StrResponse()` | `res.json(getCurrentHour24StrResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current hour24 string fetched', value: '09' }` |
|
|
85
|
+
| `getCurrentHour12Str()` | `const h = getCurrentHour12Str();` | `string` | `'09'` |
|
|
86
|
+
| `getCurrentHour12StrResponse()` | `res.json(getCurrentHour12StrResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current hour12 string fetched', value: '09' }` |
|
|
87
|
+
| `getCurrentMinuteStr()` | `const m = getCurrentMinuteStr();` | `string` | `'05'` |
|
|
88
|
+
| `getCurrentMinuteStrResponse()` | `res.json(getCurrentMinuteStrResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current minute string fetched', value: '05' }` |
|
|
89
|
+
| `getCurrentSecondStr()` | `const s = getCurrentSecondStr();` | `string` | `'07'` |
|
|
90
|
+
| `getCurrentSecondStrResponse()` | `res.json(getCurrentSecondStrResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current second string fetched', value: '07' }` |
|
|
91
|
+
| `getCurrentPeriod()` | `const p = getCurrentPeriod();` | `{ period }` | `{ period: 'AM' }` |
|
|
92
|
+
| `getCurrentPeriodResponse()` | `res.json(getCurrentPeriodResponse());` | `{ success, code, msg, period }` | `{ success: true, code: 200, msg: 'Current period fetched successfully', period: {...} }` |
|
|
93
93
|
|
|
94
94
|
### 📅 Date helpers
|
|
95
95
|
|
|
96
|
-
| Name | Example
|
|
97
|
-
| --------------------- |
|
|
98
|
-
| `formatCurrentDate()` | `formatCurrentDate()` | `{ date: { yr, month, day, date, ordinal, fullDate } }` |
|
|
99
|
-
| `currentYear()` | `currentYear()`
|
|
100
|
-
| `currentMonth()` | `currentMonth()
|
|
101
|
-
| `currentDay()` | `currentDay()
|
|
102
|
-
| `currentDateNumber()` | `currentDateNumber()` | `{ date, dateStr }`
|
|
103
|
-
| `currentOrdinal()` | `currentOrdinal()
|
|
104
|
-
| `currentFullDate()` | `currentFullDate()
|
|
96
|
+
| Name | Example Usage | Output Format | Example Data |
|
|
97
|
+
| --------------------- | ----------------------------------- | ------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
98
|
+
| `formatCurrentDate()` | `const date = formatCurrentDate();` | `{ date: { yr, month, day, date, ordinal, fullDate } }` | `{ date: { yr: 2025, month: 'December', day: 'Wednesday', date: 24, ordinal: 'th', fullDate: 'December 24th, Wednesday, 2025' } }` |
|
|
99
|
+
| `currentYear()` | `const yr = currentYear();` | `number` | `2025` |
|
|
100
|
+
| `currentMonth()` | `const mon = currentMonth();` | `{ monthNumber, monthName, monthStr }` | `{ monthNumber: 12, monthName: 'December', monthStr: '12' }` |
|
|
101
|
+
| `currentDay()` | `const day = currentDay();` | `{ dayIndex, dayName }` | `{ dayIndex: 3, dayName: 'Wednesday' }` |
|
|
102
|
+
| `currentDateNumber()` | `const d = currentDateNumber();` | `{ date, dateStr }` | `{ date: 24, dateStr: '24' }` |
|
|
103
|
+
| `currentOrdinal()` | `const ord = currentOrdinal();` | `{ ordinal }` | `{ ordinal: 'th' }` |
|
|
104
|
+
| `currentFullDate()` | `const full = currentFullDate();` | `{ fullDate }` | `{ fullDate: 'December 24th, Wednesday, 2025' }` |
|
|
105
105
|
|
|
106
106
|
### 🗂 Date response helpers
|
|
107
107
|
|
|
108
|
-
| Name | Example
|
|
109
|
-
| -------------------------------- |
|
|
110
|
-
| `getCurrentDate()` | `getCurrentDate()
|
|
111
|
-
| `getCurrentYearResponse()` | `getCurrentYearResponse()
|
|
112
|
-
| `getCurrentMonthResponse()` | `getCurrentMonthResponse()
|
|
113
|
-
| `getCurrentDayResponse()` | `getCurrentDayResponse()
|
|
114
|
-
| `getCurrentDateNumberResponse()` | `getCurrentDateNumberResponse()` | `{ success, code, msg, value }`
|
|
115
|
-
| `getCurrentOrdinalResponse()` | `getCurrentOrdinalResponse()
|
|
116
|
-
| `getCurrentFullDateResponse()` | `getCurrentFullDateResponse()
|
|
108
|
+
| Name | Example Usage | Output Format | Example Data |
|
|
109
|
+
| -------------------------------- | ------------------------------------------- | ------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
|
|
110
|
+
| `getCurrentDate()` | `res.json(getCurrentDate());` | `{ success, code, msg, data }` | `{ success: true, code: 200, msg: 'Current date fetched successfully', data: {...} }` |
|
|
111
|
+
| `getCurrentYearResponse()` | `res.json(getCurrentYearResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current year fetched successfully', value: 2025 }` |
|
|
112
|
+
| `getCurrentMonthResponse()` | `res.json(getCurrentMonthResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current month fetched successfully', value: {...} }` |
|
|
113
|
+
| `getCurrentDayResponse()` | `res.json(getCurrentDayResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current day fetched successfully', value: {...} }` |
|
|
114
|
+
| `getCurrentDateNumberResponse()` | `res.json(getCurrentDateNumberResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current date number fetched successfully', value: {...} }` |
|
|
115
|
+
| `getCurrentOrdinalResponse()` | `res.json(getCurrentOrdinalResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current ordinal fetched successfully', value: {...} }` |
|
|
116
|
+
| `getCurrentFullDateResponse()` | `res.json(getCurrentFullDateResponse());` | `{ success, code, msg, value }` | `{ success: true, code: 200, msg: 'Current full date fetched successfully', value: 'December 24th, Wednesday, 2025' }` |
|
|
117
117
|
|
|
118
118
|
---
|
|
119
119
|
|
|
@@ -132,7 +132,7 @@ Success (example):
|
|
|
132
132
|
}
|
|
133
133
|
```
|
|
134
134
|
|
|
135
|
-
String
|
|
135
|
+
String only helper responses use `value`:
|
|
136
136
|
|
|
137
137
|
```json
|
|
138
138
|
{
|
|
@@ -143,14 +143,6 @@ String-only helper responses use `value`:
|
|
|
143
143
|
}
|
|
144
144
|
```
|
|
145
145
|
|
|
146
|
-
---
|
|
147
|
-
|
|
148
|
-
## 🤝 Contributing
|
|
149
|
-
|
|
150
|
-
PRs welcome. Keep changes small and add tests for functional changes.
|
|
151
|
-
|
|
152
|
-
---
|
|
153
|
-
|
|
154
146
|
## 🌐 Links & socials
|
|
155
147
|
|
|
156
148
|
- GitHub: https://github.com/yasasbanukaofficial
|