summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/qthelper.cpp17
-rw-r--r--core/qthelper.h2
2 files changed, 19 insertions, 0 deletions
diff --git a/core/qthelper.cpp b/core/qthelper.cpp
index 0ad112124..ea5514824 100644
--- a/core/qthelper.cpp
+++ b/core/qthelper.cpp
@@ -948,6 +948,23 @@ char *get_dive_date_c_string(timestamp_t when)
return copy_qstring(text);
}
+static QString get_dive_only_date_string(timestamp_t when)
+{
+ QDateTime ts;
+ ts.setMSecsSinceEpoch(when * 1000L);
+ return loc.toString(ts.toUTC(), QString(prefs.date_format));
+}
+
+QString get_first_dive_date_string()
+{
+ return dive_table.nr > 0 ? get_dive_only_date_string(dive_table.dives[0]->when) : gettextFromC::tr("no dives");
+}
+
+QString get_last_dive_date_string()
+{
+ return dive_table.nr > 0 ? get_dive_only_date_string(dive_table.dives[dive_table.nr - 1]->when) : gettextFromC::tr("no dives");
+}
+
extern "C" char *get_current_date()
{
QDateTime ts(QDateTime::currentDateTime());;
diff --git a/core/qthelper.h b/core/qthelper.h
index 090f4fc6f..bd205228b 100644
--- a/core/qthelper.h
+++ b/core/qthelper.h
@@ -72,6 +72,8 @@ QString render_seconds_to_string(int seconds);
QString get_dive_duration_string(timestamp_t when, QString hoursText, QString minutesText, QString secondsText = gettextFromC::tr("sec"), QString separator = ":", bool isFreeDive = false);
QString get_dive_surfint_string(timestamp_t when, QString daysText, QString hoursText, QString minutesText, QString separator = " ", int maxdays = 4);
QString get_dive_date_string(timestamp_t when);
+QString get_first_dive_date_string();
+QString get_last_dive_date_string();
QString get_short_dive_date_string(timestamp_t when);
QString get_trip_date_string(timestamp_t when, int nr, bool getday);
QString uiLanguage(QLocale *callerLoc);