Add new time format :short_datetime
Improve DurationComponent for render time without seconds. I believe that adding the seconds in this component is not necessary.
This commit is contained in:
@@ -24,6 +24,6 @@ class Admin::Budgets::DurationComponent < ApplicationComponent
|
|||||||
end
|
end
|
||||||
|
|
||||||
def formatted_date(time)
|
def formatted_date(time)
|
||||||
time_tag(time, format: :datetime)
|
time_tag(time, format: :short_datetime)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -199,5 +199,6 @@ en:
|
|||||||
default: "%a, %d %b %Y %H:%M:%S %z"
|
default: "%a, %d %b %Y %H:%M:%S %z"
|
||||||
long: "%B %d, %Y %H:%M"
|
long: "%B %d, %Y %H:%M"
|
||||||
short: "%d %b %H:%M"
|
short: "%d %b %H:%M"
|
||||||
|
short_datetime: "%Y-%m-%d %H:%M"
|
||||||
api: "%Y-%m-%d %H"
|
api: "%Y-%m-%d %H"
|
||||||
pm: pm
|
pm: pm
|
||||||
|
|||||||
@@ -193,5 +193,6 @@ es:
|
|||||||
default: "%A, %d de %B de %Y %H:%M:%S %z"
|
default: "%A, %d de %B de %Y %H:%M:%S %z"
|
||||||
long: "%d de %B de %Y %H:%M"
|
long: "%d de %B de %Y %H:%M"
|
||||||
short: "%d de %b %H:%M"
|
short: "%d de %b %H:%M"
|
||||||
|
short_datetime: "%d/%m/%Y %H:%M"
|
||||||
api: "%d/%m/%Y %H"
|
api: "%d/%m/%Y %H"
|
||||||
pm: pm
|
pm: pm
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ describe Admin::Budgets::DurationComponent, type: :component do
|
|||||||
|
|
||||||
render dates
|
render dates
|
||||||
|
|
||||||
expect(page.text).to eq "2015-08-01 12:00:00 - 2016-09-30 16:29:59"
|
expect(page.text).to eq "2015-08-01 12:00 - 2016-09-30 16:29"
|
||||||
expect(dates).to be_html_safe
|
expect(dates).to be_html_safe
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -20,7 +20,7 @@ describe Admin::Budgets::DurationComponent, type: :component do
|
|||||||
durable = double(starts_at: Time.zone.local(2015, 8, 1, 12, 0, 0), ends_at: nil)
|
durable = double(starts_at: Time.zone.local(2015, 8, 1, 12, 0, 0), ends_at: nil)
|
||||||
render Admin::Budgets::DurationComponent.new(durable).dates
|
render Admin::Budgets::DurationComponent.new(durable).dates
|
||||||
|
|
||||||
expect(page.text).to eq "2015-08-01 12:00:00 - "
|
expect(page.text).to eq "2015-08-01 12:00 - "
|
||||||
end
|
end
|
||||||
|
|
||||||
it "shows the end date when no start date is defined" do
|
it "shows the end date when no start date is defined" do
|
||||||
@@ -28,7 +28,7 @@ describe Admin::Budgets::DurationComponent, type: :component do
|
|||||||
|
|
||||||
render Admin::Budgets::DurationComponent.new(durable).dates
|
render Admin::Budgets::DurationComponent.new(durable).dates
|
||||||
|
|
||||||
expect(page.text).to eq "- 2016-09-30 16:29:59"
|
expect(page.text).to eq "- 2016-09-30 16:29"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -202,14 +202,14 @@ describe "Admin budgets", :admin do
|
|||||||
"Reviewing voting"
|
"Reviewing voting"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"2015-07-15 00:00:00 - 2015-08-14 23:59:59",
|
"2015-07-15 00:00 - 2015-08-14 23:59",
|
||||||
"2015-08-15 00:00:00 - 2015-09-14 23:59:59",
|
"2015-08-15 00:00 - 2015-09-14 23:59",
|
||||||
"2015-09-15 00:00:00 - 2015-10-14 23:59:59",
|
"2015-09-15 00:00 - 2015-10-14 23:59",
|
||||||
"2015-10-15 00:00:00 - 2015-11-14 23:59:59",
|
"2015-10-15 00:00 - 2015-11-14 23:59",
|
||||||
"2015-11-15 00:00:00 - 2015-12-14 23:59:59",
|
"2015-11-15 00:00 - 2015-12-14 23:59",
|
||||||
"2015-11-15 00:00:00 - 2016-01-14 23:59:59",
|
"2015-11-15 00:00 - 2016-01-14 23:59",
|
||||||
"2016-01-15 00:00:00 - 2016-02-14 23:59:59",
|
"2016-01-15 00:00 - 2016-02-14 23:59",
|
||||||
"2016-02-15 00:00:00 - 2016-03-14 23:59:59"
|
"2016-02-15 00:00 - 2016-03-14 23:59"
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
"Yes",
|
"Yes",
|
||||||
|
|||||||
Reference in New Issue
Block a user