def get_filtering_condition(): shopify_settings = get_shopify_settings() if shopify_settings.last_sync_datetime: last_sync_datetime = get_datetime(shopify_settings.last_sync_datetime) timezone = pytz.timezone(get_time_zone()) timezone_abbr = timezone.localize(last_sync_datetime, is_dst=None) return 'updated_at_min="{0} {1}"'.format(last_sync_datetime.strftime("%Y-%m-%d %H:%M:%S"), timezone_abbr.tzname()) return ''
def get_filtering_condition(): shopify_settings = get_shopify_settings() if shopify_settings.last_sync_datetime: last_sync_datetime = get_datetime(shopify_settings.last_sync_datetime) timezone = pytz.timezone(get_time_zone()) timezone_abbr = timezone.localize(last_sync_datetime, is_dst=False) return 'updated_at_min="{0} {1}"'.format(last_sync_datetime.strftime("%Y-%m-%d %H:%M:%S"), timezone_abbr.tzname()) return ''
def format_date_according_to_google_calendar(all_day, starts_on, ends_on=None): if not ends_on: ends_on = starts_on + timedelta(minutes=10) date_format = { "start": { "dateTime": starts_on.isoformat(), "timeZone": get_time_zone(), }, "end": { "dateTime": ends_on.isoformat(), "timeZone": get_time_zone(), } } if all_day: # If all_day event, Google Calendar takes date as a parameter and not dateTime date_format["start"].pop("dateTime") date_format["end"].pop("dateTime") date_format["start"].update({"date": starts_on.date().isoformat()}) date_format["end"].update({"date": ends_on.date().isoformat()}) return date_format
def get_filtering_condition(): magento_settings = get_magento_settings() if magento_settings.last_sync_datetime: last_sync_datetime = get_datetime(magento_settings.last_sync_datetime) timezone = pytz.timezone(get_time_zone()) timezone_abbr = timezone.localize(last_sync_datetime, is_dst=False) utc_dt = timezone_abbr.astimezone (pytz.utc) filter = 'searchCriteria[filter_groups][0][filters][0][field]=updated_at\ &searchCriteria[filter_groups][0][filters][0][value]={0}\ &searchCriteria[filter_groups][0][filters][0][condition_type]=gt'.format(utc_dt.strftime("%Y-%m-%d %H:%M:%S")) return filter return ''
def get_tz(user): return frappe.db.get_value("User", user, "time_zone") or get_time_zone()