mirror of
https://github.com/GrassrootsEconomics/cic-dw.git
synced 2024-11-12 19:26:46 +01:00
Mohamed Sohail
861af1761d
* add: latest-token-transactions table * fix: remove token symbol from query * fix: move latest tx to dashboard domain
28 lines
545 B
Go
28 lines
545 B
Go
package date_range
|
|
|
|
import (
|
|
"net/url"
|
|
|
|
"github.com/golang-module/carbon/v2"
|
|
)
|
|
|
|
func ParseDateRange(q url.Values) (string, string) {
|
|
var from, to string
|
|
|
|
qFrom := q.Get("from")
|
|
qTo := q.Get("to")
|
|
|
|
parseFrom := carbon.Parse(qFrom)
|
|
parseTo := carbon.Parse(qTo)
|
|
|
|
if parseFrom.Error != nil || parseTo.Error != nil || qFrom == "" || qTo == "" {
|
|
from = carbon.Now().StartOfMonth().ToDateString()
|
|
to = carbon.Now().EndOfMonth().ToDateString()
|
|
} else {
|
|
from = parseFrom.ToDateString()
|
|
to = parseTo.ToDateString()
|
|
}
|
|
|
|
return from, to
|
|
}
|