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 686
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix csv export * use timeconverter API * fix detekt * implement TestTimeConverter and fix ExportCsvUseCasePropertyTest * fix TestTimeConverter * WIP : fix gradle error
- Loading branch information
Showing
3 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
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.LocalTime | ||
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 Instant.toLocalTime(): LocalTime { | ||
return this.atZone(utcZoneId).toLocalTime() | ||
} | ||
|
||
override fun LocalDateTime.toUTC(): 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