This repository has been archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 733
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement TestTimeConverter and fix ExportCsvUseCasePropertyTest
- Loading branch information
Showing
3 changed files
with
33 additions
and
3 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
shared/base/src/main/java/com/ivy/base/time/impl/TestTimeConverter.kt
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,27 @@ | ||
package com.ivy.base.time.impl | ||
|
||
import com.ivy.base.time.TimeConverter | ||
import java.time.Instant | ||
import java.time.LocalDate | ||
import java.time.LocalDateTime | ||
import java.time.ZoneId | ||
|
||
class TestTimeConverter : TimeConverter { | ||
private val utcZoneId = ZoneId.of("UTC") | ||
|
||
override fun Instant.toLocalDateTime(): LocalDateTime { | ||
return this.atZone(utcZoneId).toLocalDateTime() | ||
} | ||
|
||
override fun Instant.toLocalDate(): LocalDate { | ||
return this.atZone(utcZoneId).toLocalDate() | ||
} | ||
|
||
override fun LocalDateTime.toUTC(): Instant { | ||
return this.atZone(utcZoneId).toInstant() | ||
} | ||
|
||
fun LocalDateTime.toInstant(): Instant { | ||
return this.atZone(utcZoneId).toInstant() | ||
} | ||
} |
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