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

function DATE returns a datetime but should return a number (serial) #26

Open
bradbase opened this issue Nov 11, 2020 · 4 comments
Open
Assignees
Labels
bug Something isn't working

Comments

@bradbase
Copy link
Owner

Currently;

@xl.register()
@xl.validate_args
def DATE(
        year: func_xltypes.XlNumber,
        month: func_xltypes.XlNumber,
        day: func_xltypes.XlNumber
) -> func_xltypes.XlDateTime:
    """Returns the sequential serial number that represents a particular date.

    https://support.office.com/en-us/article/
        date-function-e36c0c8c-4104-49da-ab83-82328b832349
    """

Should return

@xl.register()
@xl.validate_args
def DATE(
        year: func_xltypes.XlNumber,
        month: func_xltypes.XlNumber,
        day: func_xltypes.XlNumber
) -> func_xltypes.XlNumber:
    """Returns the sequential serial number that represents a particular date.

    https://support.office.com/en-us/article/
        date-function-e36c0c8c-4104-49da-ab83-82328b832349
    """
@bradbase bradbase added the bug Something isn't working label Nov 11, 2020
@bradbase bradbase self-assigned this Nov 11, 2020
@strichter
Copy link
Collaborator

Then you have to remove the concept of XlDateTime from the code completely and somehow manage that with formatters. XlDateTime is definitely the right return type and it knows how to convert itself to a number for algebraic operations.

@bradbase
Copy link
Owner Author

Fair enough.

You are correct. func_xltypes.DateTime has an int.

@bradbase
Copy link
Owner Author

I've not thought it through completely but sticking with that paradigm I think there we may need to consider adding an XLTime datatype. Excel has a datatype for time and the function TIME is supposed to return a decimal which is probably best managed in a similar way DATE manages the serial integer.

@bradbase
Copy link
Owner Author

Tools down for tonight before I make an awful mess.

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

No branches or pull requests

2 participants