Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in method RailsAdmin::Support::Datetime#to_momentjs #3009

Closed
enthusiasmus opened this issue Apr 4, 2018 · 0 comments
Closed

Bug in method RailsAdmin::Support::Datetime#to_momentjs #3009

enthusiasmus opened this issue Apr 4, 2018 · 0 comments
Milestone

Comments

@enthusiasmus
Copy link

enthusiasmus commented Apr 4, 2018

When the strftime_format equals %Y-%m-%dT%H:%M:%S%:z the method to_momentjs returns %Y-%m-%[dT]%H:%M:%S%:z. Which is incorrect, because I don't want to have dT to be escaped. Whats the reson for the two regexes?

Method:

def to_momentjs
  strftime_format.gsub(/\w[^.(!?%)\W]{1,}/, '[\0]').gsub(/%(\w|\-\w)/) do |match|
    MOMENTJS_TRANSLATIONS[match]
  end
end

File: https://github.com/sferik/rails_admin/blob/c9323f69ae60f14eb31fea62c05f5f0e55cbea34/lib/rails_admin/support/datetime.rb
Version: 1.3.0

The result is a broken between ... and Filter.

@enthusiasmus enthusiasmus changed the title Bug to_momentjs Bug in method to_momentjs Apr 4, 2018
@enthusiasmus enthusiasmus changed the title Bug in method to_momentjs Bug in method RailsAdmin::Support::Datetime#to_momentjs Apr 4, 2018
@mshibuya mshibuya added this to the 3.0.0 milestone Oct 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants