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

Time in filter box is showing as unix timestamp #8278

Closed
3 tasks done
rajeshchy opened this issue Sep 23, 2019 · 7 comments
Closed
3 tasks done

Time in filter box is showing as unix timestamp #8278

rajeshchy opened this issue Sep 23, 2019 · 7 comments
Labels
!deprecated-label:bug Deprecated label - Use #bug instead .pinned Draws attention

Comments

@rajeshchy
Copy link

rajeshchy commented Sep 23, 2019

I am trying to use filter box and trying to filter data based on date. when i create filter based on date then date is being shown in epoch time.

Expected results

Date should show in yyyy-mm-dd format

Actual results

it shows in epoch time like: 1568505600000

Screenshots

https://drive.google.com/file/d/1gTnKG8QkMWkzXoiRF-5fXiwpMo_f5LqC/view?usp=sharing

How to reproduce the bug

  1. Create a table in postgres with DATE column
  2. now create table in superset
  3. Change the Datetime Format in column of table to %Y-%m-%d
  4. try to create the filter box using that column

Environment

Running superset with docker.

Checklist

Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • I have checked the issue tracker for the same issue and I haven't found one similar.

Additional context

Add any other context about the problem here.

@issue-label-bot issue-label-bot bot added the !deprecated-label:bug Deprecated label - Use #bug instead label Sep 23, 2019
@issue-label-bot
Copy link

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.84. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@rajeshchy
Copy link
Author

Screenshot:

Screen Shot 2019-09-18 at 5 21 06 PM

@williamdrake
Copy link

I'm getting this as well. Not sure of a workaround since we can't filter by custom Metrics.

@umesh11111
Copy link

change the core.py file under utils folder and change the json_int_dttm_ser function

def json_int_dttm_ser(obj):
"""json serializer that deals with dates"""
val = base_json_conv(obj)
if val is not None:
return val
if isinstance(obj, (datetime, pd.Timestamp)):
# obj = datetime_to_epoch(obj)
obj = obj.strftime("%m/%d/%Y")
elif isinstance(obj, date):

    obj = (obj - EPOCH.date()).total_seconds() * 1000
    obj = obj.strftime("%m/%d/%Y")
else:
    raise TypeError("Unserializable object {} of type {}".format(obj, type(obj)))
return obj

this worked for me ..

@stale
Copy link

stale bot commented Dec 9, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Dec 9, 2019
@mistercrunch mistercrunch added the .pinned Draws attention label Dec 10, 2019
@stale stale bot removed the inactive Inactive for >= 30 days label Dec 10, 2019
@junlincc
Copy link
Member

problem resolved. #10268

@snehlata08
Copy link

change the core.py file under utils folder and change the json_int_dttm_ser function

def json_int_dttm_ser(obj): """json serializer that deals with dates""" val = base_json_conv(obj) if val is not None: return val if isinstance(obj, (datetime, pd.Timestamp)): # obj = datetime_to_epoch(obj) obj = obj.strftime("%m/%d/%Y") elif isinstance(obj, date):

    obj = (obj - EPOCH.date()).total_seconds() * 1000
    obj = obj.strftime("%m/%d/%Y")
else:
    raise TypeError("Unserializable object {} of type {}".format(obj, type(obj)))
return obj

this worked for me ..

This didn't work for me. Can you please show the full code. Is there some mistake that I might have done.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
!deprecated-label:bug Deprecated label - Use #bug instead .pinned Draws attention
Projects
None yet
Development

No branches or pull requests

6 participants