@brt-innovation/aether 1.3.0 → 1.3.1
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.dev.md +6 -2
- package/README.md +44 -0
- package/package.json +3 -2
package/README.dev.md
CHANGED
|
@@ -34,7 +34,11 @@ git checkout main
|
|
|
34
34
|
git pull origin main
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### 4.
|
|
37
|
+
### 4. Update README.md
|
|
38
|
+
|
|
39
|
+
Update the README.md file to include the latest changes.
|
|
40
|
+
|
|
41
|
+
### 5. Bump Version
|
|
38
42
|
|
|
39
43
|
Update the package version. This command updates `package.json`, `package-lock.json`, creates a git commit, and adds a git tag.
|
|
40
44
|
|
|
@@ -48,7 +52,7 @@ Examples:
|
|
|
48
52
|
- `npm version minor` (1.0.0 -> 1.1.0)
|
|
49
53
|
- `npm version major` (1.0.0 -> 2.0.0)
|
|
50
54
|
|
|
51
|
-
###
|
|
55
|
+
### 6. Publish
|
|
52
56
|
|
|
53
57
|
Publish the package to the registry.
|
|
54
58
|
|
package/README.md
CHANGED
|
@@ -128,6 +128,50 @@ app.onError(onAppError);
|
|
|
128
128
|
|
|
129
129
|
---
|
|
130
130
|
|
|
131
|
+
### Dayjs Utilities
|
|
132
|
+
|
|
133
|
+
Common date/time utilities pre-configured with `dayjs`, `utc`, and `timezone` plugins. `Asia/Bangkok` is used as the default timezone for BKK specific functions.
|
|
134
|
+
|
|
135
|
+
**Import**
|
|
136
|
+
|
|
137
|
+
```ts
|
|
138
|
+
import {
|
|
139
|
+
startOfDayBkk,
|
|
140
|
+
endOfDayBkk,
|
|
141
|
+
startOfDayBkkToUtc,
|
|
142
|
+
endOfDayBkkToUtc,
|
|
143
|
+
convertUtcToBkk,
|
|
144
|
+
convertBkkToUtc,
|
|
145
|
+
formatDate,
|
|
146
|
+
bkkTimezone,
|
|
147
|
+
} from '@brt-innovation/aether';
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
**Available Functions**
|
|
151
|
+
|
|
152
|
+
- `bkkTimezone`: Constant `'Asia/Bangkok'`.
|
|
153
|
+
- `startOfDayBkk(date)`: Returns the start of the day (00:00:00) in Bangkok timezone as a `Date` object.
|
|
154
|
+
- `endOfDayBkk(date)`: Returns the end of the day (23:59:59.999) in Bangkok timezone as a `Date` object.
|
|
155
|
+
- `startOfDayBkkToUtc(date)`: Returns the start of the day in Bangkok, converted to UTC as a `Date` object.
|
|
156
|
+
- `endOfDayBkkToUtc(date)`: Returns the end of the day in Bangkok, converted to UTC as a `Date` object.
|
|
157
|
+
- `convertUtcToBkk(date)`: Converts a UTC date to Bangkok time (Date object with BKK wall time).
|
|
158
|
+
- `convertBkkToUtc(date)`: Converts a Bangkok date to UTC.
|
|
159
|
+
- `formatDate(date, options)`: Formats a date string or object.
|
|
160
|
+
- `options.format`: Format string (default: `'YYYY-MM-DD HH:mm:ss'`)
|
|
161
|
+
- `options.timezone`: Target timezone (default: `'UTC'`, options: `'UTC'`, `'Asia/Bangkok'`)
|
|
162
|
+
|
|
163
|
+
**Example**
|
|
164
|
+
|
|
165
|
+
```ts
|
|
166
|
+
import { formatDate, startOfDayBkk, bkkTimezone } from '@brt-innovation/aether';
|
|
167
|
+
|
|
168
|
+
const now = new Date();
|
|
169
|
+
const bkkStart = startOfDayBkk(now);
|
|
170
|
+
const formatted = formatDate(now, { timezone: bkkTimezone, format: 'DD/MM/YYYY' });
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
131
175
|
## License
|
|
132
176
|
|
|
133
177
|
UNLICENSED - Internal use only for BRT Innovation
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@brt-innovation/aether",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"description": "Shared utilities and middlewares for Aether microservices",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -17,7 +17,8 @@
|
|
|
17
17
|
},
|
|
18
18
|
"scripts": {
|
|
19
19
|
"build": "tsup src/index.ts --dts --tsconfig tsconfig.json",
|
|
20
|
-
"test": "vitest",
|
|
20
|
+
"test": "vitest run",
|
|
21
|
+
"test:watch": "vitest",
|
|
21
22
|
"format": "prettier --write .",
|
|
22
23
|
"format:check": "prettier --check .",
|
|
23
24
|
"prepare": "npm run build",
|