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

Add DATE support to orbits model #48

Open
galaGOlol opened this issue Jan 1, 2021 · 2 comments
Open

Add DATE support to orbits model #48

galaGOlol opened this issue Jan 1, 2021 · 2 comments

Comments

@galaGOlol
Copy link

galaGOlol commented Jan 1, 2021

Hi All,
Using orbit to develop a small wiki-type application,
I was given an error whenver I tried to parse something with the DATE field.
It did not have a parser for it. So I edited orbit/model.lua, and basically copied the datetime function.
Here is a diff, if you are interested in adding support for DATE:

98a99,102
> function convert.date(v)
> 	local year, month, day = string.match(v, "(%d+)%-(%d+)%-(%d+)")
> 	return os.time({year=tonumber(year), month=tonumber(month), day=tonumber(day)})
> end
153a158,161
> 
> function escape.date(v)
> 	return "'" .. os.date("%Y-%m-%d", v) .. "'"
> end

I had a few concerns about it.

  1. There is no difference between date and datetime in lua, this could possibly lead to bugs in programs that rely on a time (Since it would be noon, but are only given a date. Hopefully the developer would be aware of that though.
  2. Is it possible to use datetime for date? I tried, but I get the following:
/usr/share/lua/5.1/orbit/model.lua:93: field 'day' missing in date table

This seems to be because of the expression you use to find date. it is (%d+)%-(%d+)%-(%d+) (%d+):(%d+):(%d+)
This means that the day will not be matched for type date, since it does not follow a space. I don't know if you would prefer modifying the expression, or adding a separate function.

Either way, we would want a different function for escape.date.
Is there any reason DATE is not supported? Or is it just waiting for someone to bake support in?

Let me know what you guys think. If you want, I can fork and do a PR, but I don't speak git very well.
Happy new year!

@galaGOlol
Copy link
Author

I notice that this project isn't very active.
Perhaps @hishamhm can tell me if orbit is still developed.
If it isn't, and there isn't a replacement we should be switching to, I would be willing to maintain it in some fashion, though I have not maintained anything before.
I am writing a project in orbit though, and so it is in my best interest to make sure it is maintained.
Thanks!

@galaGOlol
Copy link
Author

@mascarenhas @norman @ignacio @rjpcomputing Is there a replacement for Orbit?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant