Skip to content

Commit

Permalink
Display Dates In Locale Format
Browse files Browse the repository at this point in the history
  • Loading branch information
nlogozzo committed Nov 16, 2022
1 parent 57555e7 commit 854f5f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/ui/controls/transactionrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ TransactionRow::TransactionRow(const Transaction& transaction, const std::locale
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(m_gobj), builder.str().c_str());
builder.str("");
builder.clear();
builder << boost::gregorian::to_iso_extended_string(m_transaction.getDate());
builder << g_date_time_format(g_date_time_new_local(m_transaction.getDate().year(), m_transaction.getDate().month(), m_transaction.getDate().day(), 0, 0, 0.0), "%x");
if(m_transaction.getRepeatInterval() != RepeatInterval::Never)
{
builder << "\n" << _("Repeat Interval: ") << m_transaction.getRepeatIntervalAsString();
Expand Down
5 changes: 3 additions & 2 deletions src/ui/views/transactiondialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ TransactionDialog::TransactionDialog(GtkWindow* parent, NickvisionMoney::Control
gtk_widget_add_css_class(m_btnDate, "flat");
gtk_widget_set_valign(m_btnDate, GTK_ALIGN_CENTER);
gtk_menu_button_set_popover(GTK_MENU_BUTTON(m_btnDate), m_popoverDate);
gtk_menu_button_set_label(GTK_MENU_BUTTON(m_btnDate), g_date_time_format(gtk_calendar_get_date(GTK_CALENDAR(m_calendarDate)), "%Y-%m-%d"));
gtk_menu_button_set_label(GTK_MENU_BUTTON(m_btnDate), g_date_time_format(gtk_calendar_get_date(GTK_CALENDAR(m_calendarDate)), "%x"));
m_rowDate = adw_action_row_new();
gtk_widget_set_size_request(m_rowDate, 420, -1);
adw_preferences_row_set_title(ADW_PREFERENCES_ROW(m_rowDate), _("Date"));
Expand Down Expand Up @@ -139,6 +139,7 @@ void TransactionDialog::setResponse(const std::string& response)

void TransactionDialog::onDateChanged()
{
gtk_menu_button_set_label(GTK_MENU_BUTTON(m_btnDate), g_date_time_format(gtk_calendar_get_date(GTK_CALENDAR(m_calendarDate)), "%Y-%m-%d"));
gtk_menu_button_set_label(GTK_MENU_BUTTON(m_btnDate), g_date_time_format(gtk_calendar_get_date(GTK_CALENDAR(m_calendarDate)), "%x"));
gtk_popover_popdown(GTK_POPOVER(m_popoverDate));
}

0 comments on commit 854f5f0

Please sign in to comment.