def fields(self, *args, **kwargs):
dt = arrow.get(try_parse_date('Mon Jan 22 15:04:05 -0800 2006')).to('utc')
choices = ','.join(['{}|{} ({})'.format(f, f, dt.format(f)) for f in PREDEFINED_DATE_FORMATS])
timezones = list(sorted(pytz.common_timezones, key=lambda v: '-' + v if v.startswith('US') else v))
return [
{
'type': 'unicode',
'required': True,
'key': 'to_format',
'choices': choices,
'help_text': 'Provide the format that the date is converted to. For date format help, see: https://zapier.com/help/formatter/#date-time'
},
{
'type': 'unicode',
'required': False,
'key': 'to_timezone',
'label': 'To Timezone',
'choices': timezones,
'default': 'UTC',
'help_text': 'Choose a timezone the date should be converted to. (Default: UTC)'
},
{
'type': 'unicode',
'required': False,
'key': 'from_format',
'choices': choices,
'help_text': 'If we incorrectly interpret the incoming (input) date, set this to explicitly tell us the format. Otherwise, we will do our best to figure it out.' # NOQA
},
{
'type': 'unicode',
'required': False,
'key': 'from_timezone',
'label': 'From Timezone',
'choices': timezones,
'default': 'UTC',
'help_text': 'If no timezone is provided in the incoming (input) data, set this to explicitly tell us which to use. (Default: UTC)' # NOQA
},
]
评论列表
文章目录