diff --git a/src/apps/chifra/pkg/types/types_chunkaddress.go b/src/apps/chifra/pkg/types/types_chunkaddress.go index 768389fc83..c7f020b06e 100644 --- a/src/apps/chifra/pkg/types/types_chunkaddress.go +++ b/src/apps/chifra/pkg/types/types_chunkaddress.go @@ -52,7 +52,9 @@ func (s *ChunkAddress) Model(chain, format string, verbose bool, extraOpts map[s if verbose { if format == "json" { - model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + if !s.RangeDates.IsDefault() { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } } else { model["firstTs"] = s.RangeDates.FirstTs model["firstDate"] = s.RangeDates.FirstDate diff --git a/src/apps/chifra/pkg/types/types_chunkbloom.go b/src/apps/chifra/pkg/types/types_chunkbloom.go index 33d7a9f9ef..47c017c14b 100644 --- a/src/apps/chifra/pkg/types/types_chunkbloom.go +++ b/src/apps/chifra/pkg/types/types_chunkbloom.go @@ -67,7 +67,9 @@ func (s *ChunkBloom) Model(chain, format string, verbose bool, extraOpts map[str if verbose { if format == "json" { - model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + if !s.RangeDates.IsDefault() { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } } else { model["firstTs"] = s.RangeDates.FirstTs model["firstDate"] = s.RangeDates.FirstDate diff --git a/src/apps/chifra/pkg/types/types_chunkindex.go b/src/apps/chifra/pkg/types/types_chunkindex.go index 877efde668..07dcc3b8c7 100644 --- a/src/apps/chifra/pkg/types/types_chunkindex.go +++ b/src/apps/chifra/pkg/types/types_chunkindex.go @@ -62,7 +62,9 @@ func (s *ChunkIndex) Model(chain, format string, verbose bool, extraOpts map[str if verbose { if format == "json" { - model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + if !s.RangeDates.IsDefault() { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } } else { model["firstTs"] = s.RangeDates.FirstTs model["firstDate"] = s.RangeDates.FirstDate diff --git a/src/apps/chifra/pkg/types/types_chunkrecord.go b/src/apps/chifra/pkg/types/types_chunkrecord.go index e5f7dc4e28..430a0fee3d 100644 --- a/src/apps/chifra/pkg/types/types_chunkrecord.go +++ b/src/apps/chifra/pkg/types/types_chunkrecord.go @@ -55,7 +55,9 @@ func (s *ChunkRecord) Model(chain, format string, verbose bool, extraOpts map[st if verbose { if format == "json" { - model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + if !s.RangeDates.IsDefault() { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } } else { model["firstTs"] = s.RangeDates.FirstTs model["firstDate"] = s.RangeDates.FirstDate diff --git a/src/apps/chifra/pkg/types/types_chunkstats.go b/src/apps/chifra/pkg/types/types_chunkstats.go index 2f1799c017..5434990da5 100644 --- a/src/apps/chifra/pkg/types/types_chunkstats.go +++ b/src/apps/chifra/pkg/types/types_chunkstats.go @@ -72,7 +72,9 @@ func (s *ChunkStats) Model(chain, format string, verbose bool, extraOpts map[str if verbose { if format == "json" { - model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + if !s.RangeDates.IsDefault() { + model["rangeDates"] = s.RangeDates.Model(chain, format, verbose, extraOpts).Data + } } else { model["firstTs"] = s.RangeDates.FirstTs model["firstDate"] = s.RangeDates.FirstDate diff --git a/src/apps/chifra/pkg/types/types_rangedates.go b/src/apps/chifra/pkg/types/types_rangedates.go index 4645c35f9d..4023d92de4 100644 --- a/src/apps/chifra/pkg/types/types_rangedates.go +++ b/src/apps/chifra/pkg/types/types_rangedates.go @@ -67,4 +67,8 @@ func (p1 *RangeDates) Cmp(p2 RangeDates) int64 { return p1.FirstTs.Int64() - p2.FirstTs.Int64() } +func (p1 *RangeDates) IsDefault() bool { + return p1.Cmp(RangeDates{}) == 0 +} + // EXISTING_CODE