Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dealing with dates #48

Open
albinvll opened this issue Nov 1, 2021 · 6 comments · Fixed by #49
Open

Dealing with dates #48

albinvll opened this issue Nov 1, 2021 · 6 comments · Fixed by #49
Labels
bug Something isn't working enhancement New feature or request

Comments

@albinvll
Copy link

albinvll commented Nov 1, 2021

Hello, I am very interested to see how this project goes, the idea seems great and using it looks simple but powerful. However I ran into this problem when working with arrays with dates. Maybe there's something I haven't learned yet seeing as I'm as new to this as the language :^), but the Date Objects are empty. Good luck on this project!
Rows

@evinism evinism added the bug Something isn't working label Nov 1, 2021
@evinism
Copy link
Owner

evinism commented Nov 1, 2021

Good find! I'd consider this an oversight / bug of the JS library implementation (the translation from JS types to MistQL types isn't yet robustly specified), but dates should almost certainly be translated as ISO 8601 compliant strings. Formalizing this will be incredibly useful to do.

An additional possibility is adding a core "date" type to MistQL, but honestly that would add a LOT of complexity, not just for the specification of the language, but the interface to it.

@cfilipov
Copy link

cfilipov commented Nov 1, 2021

My suggestion is to not assume a single date serialization format like 8601 and instead provide date helper functions that can be used to deal with all different types of date handling situations. SQLite's handling of date comes to mind. They don't actually have a date type but some functions that make it easy to deal with parsing and formatting dates.

@evinism
Copy link
Owner

evinism commented Nov 1, 2021

@cfilipov 100% agree -- to me it feels like the right choice is to lean on existing datatypes and leverage helpers to assist in date processing. The translation from JS Date type to MistQL would need to be standardized, which is where 8601 comes in.

@evinism evinism added the enhancement New feature or request label Nov 1, 2021
@evinism
Copy link
Owner

evinism commented Nov 1, 2021

Going to adopt JSON.stringify behavior as my basis for conversion semantics from JS to MistQL. I can probably do that for other languages as well.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify

Edit: I thought a few of the translations would be a bit unintuitive, so I've changed them a little.

@evinism evinism linked a pull request Nov 2, 2021 that will close this issue
@evinism evinism reopened this Nov 4, 2021
@evinism
Copy link
Owner

evinism commented Nov 4, 2021

Probably a good idea to keep this issue open, as we'll need at least a few date helpers.

@evinism
Copy link
Owner

evinism commented Apr 19, 2022

all but forgot about python here. Aiming to make date(2015, 1, 1) -> 2015-1-1 per iso, and have datetime map the same as it does in JS.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants