Skip to content
Repos

DevPlaceApp

C++ 487 B19 lines Opens in site

Directory Raw Download

#pragma once
// Spec: models.md birth date formatter (yyyy-MM-dd, en_US_POSIX, device time zone).
#include <string>

#include "core/Date.hpp"

namespace dp {

struct BirthDate {
  int year = 1970;
  unsigned month = 1;
  unsigned day = 1;

  // Civil date of `date` in the local time zone (like DateFormatter without an explicit zone).
  static BirthDate fromDate(Date date);
  std::string toString() const { return DateCodec::formatBirthDate(year, month, day); }
};

}  // namespace dp
26.3ms