Distinguish initial scan to import last time write as added time, ref #601
This commit is contained in:
@@ -22,6 +22,10 @@
|
||||
#include <limits>
|
||||
#include <sstream>
|
||||
|
||||
#include <Wt/WDate.h>
|
||||
#include <Wt/WDateTime.h>
|
||||
#include <Wt/WTime.h>
|
||||
|
||||
namespace lms::core
|
||||
{
|
||||
PartialDateTime::PartialDateTime(int year)
|
||||
@@ -84,6 +88,18 @@ namespace lms::core
|
||||
return res;
|
||||
}
|
||||
|
||||
PartialDateTime PartialDateTime::fromWtDateTime(const Wt::WDateTime& dateTime)
|
||||
{
|
||||
return core::PartialDateTime{
|
||||
dateTime.date().year(),
|
||||
static_cast<unsigned>(dateTime.date().month()),
|
||||
static_cast<unsigned>(dateTime.date().day()),
|
||||
static_cast<unsigned>(dateTime.time().hour()),
|
||||
static_cast<unsigned>(dateTime.time().minute()),
|
||||
static_cast<unsigned>(dateTime.time().second())
|
||||
};
|
||||
}
|
||||
|
||||
std::string PartialDateTime::toISO8601String() const
|
||||
{
|
||||
if (_precision == Precision::Invalid)
|
||||
|
||||
@@ -23,6 +23,11 @@
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
namespace Wt
|
||||
{
|
||||
class WDateTime;
|
||||
}
|
||||
|
||||
namespace lms::core
|
||||
{
|
||||
class PartialDateTime
|
||||
@@ -35,6 +40,7 @@ namespace lms::core
|
||||
PartialDateTime(int year, unsigned month, unsigned day, unsigned hour, unsigned min, unsigned sec);
|
||||
|
||||
static PartialDateTime fromString(std::string_view str);
|
||||
static PartialDateTime fromWtDateTime(const Wt::WDateTime& dateTime);
|
||||
std::string toISO8601String() const;
|
||||
|
||||
bool isValid() const { return _precision != Precision::Invalid; }
|
||||
|
||||
Reference in New Issue
Block a user