Timestamp in seconds (Epoch style)

This commit is contained in:
quadbyte 2025-08-11 18:05:39 -04:00
parent 644f647653
commit e56a89e3ed
2 changed files with 9 additions and 5 deletions

View file

@ -10,7 +10,7 @@ Singleton {
property var date: new Date()
property string time: Settings.data.location.use12HourClock ? Qt.formatDateTime(date, "h:mm AP") : Qt.formatDateTime(
date, "HH:mm")
property string dateString: {
readonly property string dateString: {
let now = date
let dayName = now.toLocaleDateString(Qt.locale(), "ddd")
dayName = dayName.charAt(0).toUpperCase() + dayName.slice(1)
@ -38,6 +38,11 @@ Singleton {
+ (Settings.data.location.reverseDayMonth ? `${month} ${day}${suffix} ${year}` : `${day}${suffix} ${month} ${year}`)
}
// Returns a Unix Timestamp (in seconds)
readonly property string timestamp: {
return Math.floor(Date.now() / 1000);
}
// Format an easy to read approximate duration ex: 4h32m
// Used to display the time remaining on the Battery widget
function formatVagueHumanReadableDuration(totalSeconds) {