mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) New type conversion in the backend
Summary: This is https://phab.getgrist.com/D3205 plus some changes (https://github.com/dsagal/grist/compare/type-convert...type-convert-server?expand=1) that move the conversion process to the backend. A new user action ConvertFromColumn uses `call_external` so that the data engine can delegate back to ActiveDoc. Code for creating formatters and parsers is significantly refactored so that most of the logic is in `common` and can be used in different ways. Test Plan: The original diff adds plenty of tests. Reviewers: georgegevoian Reviewed By: georgegevoian Subscribers: dsagal Differential Revision: https://phab.getgrist.com/D3240
This commit is contained in:
@@ -4,7 +4,6 @@ import marshal
|
||||
from time import time
|
||||
import bisect
|
||||
import os
|
||||
import moment_parse
|
||||
import iso8601
|
||||
import six
|
||||
from six.moves import zip
|
||||
@@ -13,7 +12,6 @@ from six.moves import zip
|
||||
ZoneRecord = namedtuple("ZoneRecord", ("name", "abbrs", "offsets", "untils"))
|
||||
|
||||
# moment.py mirrors core functionality of moment-timezone.js
|
||||
# moment.py includes function parse, located and documented in moment_parse.py
|
||||
# Documentation: http://momentjs.com/timezone/docs/
|
||||
|
||||
EPOCH = datetime(1970, 1, 1)
|
||||
@@ -67,10 +65,6 @@ def date_to_ts(date, timezone=None):
|
||||
ts = (date - DATE_EPOCH).total_seconds()
|
||||
return ts if not timezone else ts - timezone.offset(ts * 1000).total_seconds()
|
||||
|
||||
# Calls parse from moment_parse.py
|
||||
def parse(date_string, parse_format, zonelabel='UTC'):
|
||||
return moment_parse.parse(date_string, parse_format, zonelabel)
|
||||
|
||||
# Parses a datetime in the ISO format, YYYY-MM-DDTHH:MM:SS.mmmmmm+HH:MM. Most parts are optional;
|
||||
# see https://pypi.org/project/iso8601/ for details. Returns a timestamp in seconds.
|
||||
def parse_iso(date_string, timezone=None):
|
||||
|
||||
Reference in New Issue
Block a user