mirror of
https://github.com/discourse/discourse.git
synced 2026-08-04 10:39:43 +08:00
Related: https://meta.discourse.org/t/request-for-a-date-picker-in-ai-translate-settings/405828 The backfill translation setting was "max age days". This resulted in a running date, which meant the older topics couldn't get updated if the date keeps running from today.
19 lines
331 B
Ruby
Vendored
19 lines
331 B
Ruby
Vendored
# frozen_string_literal: true
|
|
|
|
class DateSettingValidator
|
|
def initialize(opts = {})
|
|
@opts = opts
|
|
end
|
|
|
|
def valid_value?(val)
|
|
return true if val.blank?
|
|
|
|
Date.iso8601(val).iso8601 == val
|
|
rescue ArgumentError, TypeError
|
|
false
|
|
end
|
|
|
|
def error_message
|
|
I18n.t("site_settings.errors.invalid_date")
|
|
end
|
|
end
|