Skip to content

Commit

Permalink
Merge pull request #614 from ChicagoWorldcon/PLAN-699-adjust-time-format
Browse files Browse the repository at this point in the history
PLAN-699 change date format for excel to be 12 hour (2.0)
  • Loading branch information
Gailbear authored Aug 12, 2022
2 parents 406167b + aba977a commit 841d1e9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ class ApplicationController < ActionController::Base
include Pundit::Authorization
include JSONAPI::Errors

EXCEL_NBR_FORMAT = "[$-409]d mmm yyyy h:mm AM/PM;@".freeze

skip_before_action :verify_authenticity_token

before_action :configure_permitted_parameters, if: :devise_controller?
Expand Down
4 changes: 2 additions & 2 deletions app/controllers/reports/program_ops_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def back_of_badge

workbook = FastExcel.open #(constant_memory: true)
worksheet = workbook.add_worksheet("Back of Badge")
date_time_style = workbook.number_format("d mmm yyyy h:mm")
date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)

worksheet.append_row([]) # For the header

Expand All @@ -27,7 +27,7 @@ def back_of_badge
row.concat [
assignment.session.title,
assignment.session.start_time ? FastExcel.date_num(assignment.session.start_time, assignment.session.start_time.in_time_zone.utc_offset) : nil,
assignment.session.duration,
assignment.session.duration + 'mins',
assignment.session.room&.name,
]
styles.concat [
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reports/schedule_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def schedule_diff

to ||= Time.now
workbook = FastExcel.open(constant_memory: true)
date_time_style = workbook.number_format("d mmm yyyy h:mm")
date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)

session_time_changed = workbook.add_worksheet("Session Time Changed")
session_room_changed = workbook.add_worksheet("Session Room Changed")
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/reports/session_reports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def daily_grid

workbook = FastExcel.open(constant_memory: true)
worksheet = workbook.add_worksheet("Assigned Session not Sched")
date_time_style = workbook.number_format("d mmm yyyy h:mm")
date_time_style = workbook.number_format(EXCEL_NBR_FORMAT)
styles = [
nil, nil, nil, date_time_style, nil
]
Expand Down
2 changes: 1 addition & 1 deletion app/lib/active_model/xls_array_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def to_xls
workbook = FastExcel.open(constant_memory: true) # creates tmp file
worksheet = workbook.add_worksheet("Export")

date_time_style = workbook.number_format("d mmm yyyy h:mm")
date_time_style = workbook.number_format("[$-409]d mmm yyyy h:mm AM/PM;@")
date_style = workbook.number_format("d mmm yyyy")
time_style = workbook.number_format("h:mm")

Expand Down

0 comments on commit 841d1e9

Please sign in to comment.