Ivan, meu environment esta assim:
config.time_zone = 'UTC'
config.i18n.default_locale = "pt-BR"
config.gem "calendar_date_select"
config.gem "brazilian-rails"
end
CalendarDateSelect::FORMATS[:my_custom] = {
:date => "%d/%m/%Y",
:time => " %H:%M:%S",
:javascript_include => "format_my_custom"
}
require 'paperclip'
WillPaginate.enable_actionpack
WillPaginate::ViewHelpers.pagination_options[:prev_label] = 'Anterior'
WillPaginate::ViewHelpers.pagination_options[:next_label] =
'Próximo'
CalendarDateSelect.format = :my_custom
eo meu format_my_custom.js esta assim:
Date.prototype.toFormattedString = function(include_time){
str = Date.padded2(this.getDate()) + '/' + Date.padded2
(this.getMonth() + 1) + '/' + this.getFullYear();
if (include_time) { hour=this.getHours(); str += " " +
this.getAMPMHour() + ":" + this.getPaddedMinutes() + ":" + "00" }
return str;
}
Date.parseFormattedString = function (string) {
var regexp = '([0-9]{1,2})/(([0-9]{1,2})/(([0-9]{4})( ([0-9]{1,2}):
([0-9]{2}):([0-9]{2})? *)?)?)?';
var d = string.match(new RegExp(regexp, "i"));
if (d==null) {
return Date.parse(string); // Give javascript a chance to
parse it.
}
dmy = d[1].split('/');
hrs = 0;
mts = 0;
if(d[7] != null) {
hrs = parseInt(d[7].split(':'), 10);
mts = d[8].split(':');
}
return new Date(d[5], dmy, parseInt(d[3], 10)-1, hrs, mts, 0);