Skip to content

Commit 489c9a0

Browse files
committed
build: 0.2.0
1 parent 059c29b commit 489c9a0

File tree

4 files changed

+64
-61
lines changed

4 files changed

+64
-61
lines changed

package-lock.json

Lines changed: 56 additions & 53 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": "aws-lambda-stubs",
3-
"version": "0.1.2",
3+
"version": "0.2.0",
44
"main": "./dist/index.js",
55
"types": "./dist/index.d.ts",
66
"exports": {

src/api-gateway-proxy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import {
1818
APIGatewayEventRequestContextV2Stub,
1919
APIGatewayEventRequestContextV2WithAuthorizerStub,
2020
APIGatewayEventRequestContextWithAuthorizerStub,
21+
ApiGatewayParsedDateTime,
2122
DEFAULT_REGION,
22-
eventParsedDateTime,
2323
type PartialAPIGatewayEventRequestContext,
2424
type PartialAPIGatewayEventRequestContextV2,
2525
randomIpAddress,
@@ -193,7 +193,7 @@ export const APIGatewayProxyWebsocketEventV2Stub = (
193193
messageDirection: 'IN',
194194
stage: 'prod',
195195
connectedAt: currentEpoch,
196-
requestTime: eventParsedDateTime(new Date()),
196+
requestTime: ApiGatewayParsedDateTime(new Date()),
197197
requestTimeEpoch: currentEpoch,
198198
requestId: crypto.randomUUID(),
199199
domainName: `id.execute-api.${DEFAULT_REGION}.amazonaws.com`,

src/common/api-gateway.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ export type PartialAPIGatewayEventRequestContext<TAuthorizer> = Merge<
1515
}
1616
>;
1717

18-
export const eventParsedDateTime = (date: Date): string => {
18+
export const ApiGatewayParsedDateTime = (date: Date): string => {
1919
const day = String(date.getDate()).padStart(2, '0');
2020
const month = date.toLocaleString('en-US', { month: 'short' });
2121
const year = date.getFullYear();
22-
const hour = String(date.getHours());
23-
const minute = String(date.getMinutes());
24-
const second = String(date.getSeconds());
22+
const hour = String(date.getHours()).padStart(2, '0');
23+
const minute = String(date.getMinutes()).padStart(2, '0');
24+
const second = String(date.getSeconds()).padStart(2, '0');
2525

2626
const offset = -date.getTimezoneOffset(); // Reverse the sign
2727

@@ -90,7 +90,7 @@ export const APIGatewayEventRequestContextV2Stub = (
9090
requestId: crypto.randomUUID(),
9191
routeKey: '$default',
9292
stage: 'prod',
93-
time: eventParsedDateTime(new Date()),
93+
time: ApiGatewayParsedDateTime(new Date()),
9494
timeEpoch: currentEpochTime(),
9595
},
9696
overrides as Partial<APIGatewayEventRequestContextV2>

0 commit comments

Comments
 (0)