[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[libeufin] 02/02: Time-framed query.
From: |
gnunet |
Subject: |
[libeufin] 02/02: Time-framed query. |
Date: |
Wed, 02 Aug 2023 12:51:32 +0200 |
This is an automated email from the git hooks/post-receive script.
ms pushed a commit to branch master
in repository libeufin.
commit f8c9db87e4165493b97f95a4fafac70105985075
Author: MS <ms@taler.net>
AuthorDate: Wed Aug 2 12:50:00 2023 +0200
Time-framed query.
Fixing how Nexus defines the 'start' and 'end'
URI parameters along x-libeufin-bank requests.
---
.../kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt | 4 ++--
util/src/main/kotlin/time.kt | 5 +++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git
a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
index b6f025bf..6fbc8ca6 100644
---
a/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
+++
b/nexus/src/main/kotlin/tech/libeufin/nexus/xlibeufinbank/XLibeufinBankNexus.kt
@@ -268,8 +268,8 @@ class XlibeufinBankConnectionProtocol :
BankConnectionProtocol {
// the parse() method defaults to the YYYY-MM-DD format.
val start: LocalDate = LocalDate.parse(fetchSpec.start)
val end: LocalDate = LocalDate.parse(fetchSpec.end)
- this.parameters["from_ms"] = start.toString()
- this.parameters["to_ms"] = end.toString()
+ this.parameters["from_ms"] = start.millis().toString()
+ this.parameters["to_ms"] = end.millis().toString()
}
// Gets the last 5 transactions
is FetchSpecLatestJson -> {
diff --git a/util/src/main/kotlin/time.kt b/util/src/main/kotlin/time.kt
index 867d1950..13394537 100644
--- a/util/src/main/kotlin/time.kt
+++ b/util/src/main/kotlin/time.kt
@@ -54,6 +54,11 @@ fun LocalDateTime.millis(): Long {
return instant.toEpochMilli()
}
+fun LocalDate.millis(): Long {
+ val instant = Instant.from(this)
+ return instant.toEpochMilli()
+}
+
fun parseDashedDate(maybeDashedDate: String?): LocalDate {
if (maybeDashedDate == null)
throw badRequest("dashed date found as null")
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.