Skip to content

Commit

Permalink
Merge pull request #129 from poap-xyz/drops-created-with-date
Browse files Browse the repository at this point in the history
Drops created with Date
  • Loading branch information
jm42 authored Jun 27, 2024
2 parents 2ca7f8d + ae09001 commit 8d20e09
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 27 deletions.
6 changes: 3 additions & 3 deletions packages/drops/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/drops",
"version": "0.5.0",
"version": "0.5.1",
"description": "Drops module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down Expand Up @@ -29,7 +29,7 @@
"node": ">=18"
},
"dependencies": {
"@poap-xyz/providers": "0.5.0",
"@poap-xyz/utils": "0.5.0"
"@poap-xyz/providers": "0.5.1",
"@poap-xyz/utils": "0.5.1"
}
}
16 changes: 13 additions & 3 deletions packages/drops/src/DropsClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {
createOrderBy,
createBoolFilter,
createLikeFilter,
toPOAPDate,
} from '@poap-xyz/utils';
import { Drop } from './domain/Drop';
import {
Expand Down Expand Up @@ -148,9 +149,18 @@ export class DropsClient {
description: input.description,
city: input.city,
country: input.country,
start_date: input.startDate,
end_date: input.endDate,
expiry_date: input.expiryDate,
start_date:
input.startDate instanceof Date
? toPOAPDate(input.startDate)
: input.startDate,
end_date:
input.endDate instanceof Date
? toPOAPDate(input.endDate)
: input.endDate,
expiry_date:
input.expiryDate instanceof Date
? toPOAPDate(input.expiryDate)
: input.expiryDate,
event_url: input.eventUrl,
virtual_event: input.virtualEvent,
image: input.image,
Expand Down
6 changes: 3 additions & 3 deletions packages/drops/src/types/CreateDropsInput.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ export interface CreateDropsInput {
description: string;
city: string;
country: string;
startDate: string;
endDate: string;
expiryDate: string;
startDate: string | Date;
endDate: string | Date;
expiryDate: string | Date;
eventUrl: string;
virtualEvent: boolean;
image: Blob;
Expand Down
6 changes: 3 additions & 3 deletions packages/moments/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/moments",
"version": "0.5.0",
"version": "0.5.1",
"description": "Moments module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,8 +26,8 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.5.0",
"@poap-xyz/utils": "0.5.0",
"@poap-xyz/providers": "0.5.1",
"@poap-xyz/utils": "0.5.1",
"uuid": "^9.0.0"
},
"engines": {
Expand Down
6 changes: 3 additions & 3 deletions packages/poaps/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/poaps",
"version": "0.5.0",
"version": "0.5.1",
"description": "Poaps module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,8 +26,8 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/providers": "0.5.0",
"@poap-xyz/utils": "0.5.0"
"@poap-xyz/providers": "0.5.1",
"@poap-xyz/utils": "0.5.1"
},
"engines": {
"node": ">=18"
Expand Down
4 changes: 2 additions & 2 deletions packages/providers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/providers",
"version": "0.5.0",
"version": "0.5.1",
"description": "Providers module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand All @@ -26,7 +26,7 @@
"build": "rollup -c --bundleConfigAsCjs"
},
"dependencies": {
"@poap-xyz/utils": "0.5.0",
"@poap-xyz/utils": "0.5.1",
"axios": "^1.6.8",
"lodash.chunk": "^4.2.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@poap-xyz/utils",
"version": "0.5.0",
"version": "0.5.1",
"description": "Utils module for the poap.js library",
"main": "dist/cjs/index.cjs",
"module": "dist/esm/index.mjs",
Expand Down
1 change: 1 addition & 0 deletions packages/utils/src/format/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './removeSpecialCharacters';
export * from './toPOAPDate';
9 changes: 9 additions & 0 deletions packages/utils/src/format/toPOAPDate.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
export function toPOAPDate(date: Date): string {
return date
.toLocaleDateString('en-US', {
month: '2-digit',
day: '2-digit',
year: 'numeric',
})
.replace(/\//g, '-');
}
18 changes: 9 additions & 9 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -884,8 +884,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/drops@workspace:packages/drops"
dependencies:
"@poap-xyz/providers": 0.5.0
"@poap-xyz/utils": 0.5.0
"@poap-xyz/providers": 0.5.1
"@poap-xyz/utils": 0.5.1
languageName: unknown
linkType: soft

Expand All @@ -901,8 +901,8 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/moments@workspace:packages/moments"
dependencies:
"@poap-xyz/providers": 0.5.0
"@poap-xyz/utils": 0.5.0
"@poap-xyz/providers": 0.5.1
"@poap-xyz/utils": 0.5.1
"@types/uuid": ^9.0.2
uuid: ^9.0.0
languageName: unknown
Expand All @@ -912,24 +912,24 @@ __metadata:
version: 0.0.0-use.local
resolution: "@poap-xyz/poaps@workspace:packages/poaps"
dependencies:
"@poap-xyz/providers": 0.5.0
"@poap-xyz/utils": 0.5.0
"@poap-xyz/providers": 0.5.1
"@poap-xyz/utils": 0.5.1
languageName: unknown
linkType: soft

"@poap-xyz/providers@*, @poap-xyz/providers@0.5.0, @poap-xyz/providers@workspace:packages/providers":
"@poap-xyz/providers@*, @poap-xyz/providers@0.5.1, @poap-xyz/providers@workspace:packages/providers":
version: 0.0.0-use.local
resolution: "@poap-xyz/providers@workspace:packages/providers"
dependencies:
"@poap-xyz/utils": 0.5.0
"@poap-xyz/utils": 0.5.1
axios: ^1.6.8
axios-mock-adapter: ^1.21.4
jest-fetch-mock: ^3.0.3
lodash.chunk: ^4.2.0
languageName: unknown
linkType: soft

"@poap-xyz/utils@*, @poap-xyz/utils@0.5.0, @poap-xyz/utils@workspace:packages/utils":
"@poap-xyz/utils@*, @poap-xyz/utils@0.5.1, @poap-xyz/utils@workspace:packages/utils":
version: 0.0.0-use.local
resolution: "@poap-xyz/utils@workspace:packages/utils"
languageName: unknown
Expand Down

0 comments on commit 8d20e09

Please sign in to comment.