-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
107 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
export function priceBeforeDiscount(price: number, discountRate: number) { | ||
return ( | ||
Math.ceil((price * 100) / (100 - discountRate) / 1000) * 1000 | ||
).toLocaleString('ko-KR'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
export function convertToMilliseconds(dateString: string) { | ||
// Convert string to Date object | ||
const date = new Date(dateString); | ||
|
||
// Get timestamp in milliseconds | ||
const timestampMs = date.getTime(); | ||
|
||
return timestampMs; | ||
} | ||
|
||
export function convertToHumanReadable(dateString: string) { | ||
// Convert string to Date object | ||
const date = new Date(dateString); | ||
|
||
// Extract date components | ||
const year = date.getFullYear(); | ||
const month = date.getMonth() + 1; // Months are zero-based | ||
const day = date.getDate(); | ||
|
||
// Extract time components | ||
const hours = date.getHours(); | ||
const minutes = date.getMinutes(); | ||
|
||
// Format the date and time | ||
const formattedDate = `${year}.${month.toString().padStart(2, '0')}.${day | ||
.toString() | ||
.padStart(2, '0')}`; | ||
const formattedTime = `${hours.toString().padStart(2, '0')}:${minutes | ||
.toString() | ||
.padStart(2, '0')}`; | ||
|
||
// Combine the formatted date and time | ||
const humanReadableDateTime = `${formattedDate} / ${formattedTime}`; | ||
|
||
return humanReadableDateTime; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters