Comments (6)
Hi @GSapiah,
Honestly, that was news to me as well! I was thinking maybe I had just missed something in my code and realized the same behavior. I've opened a bug internally for our devs to take a look at it. Hopefully, they can shed some light on it and I'll report back here!
Internal: 925177
Take care,
Keshia
from extension-date-updater.
Thanks for the feedback @GSapiah! I've added a checkbox to adjust for time zone, can you try it out and let me know if it works for you? If it doesn't I'll re-open the issue.
Thanks,
Keshia
from extension-date-updater.
Thanks @KeshiaRose , I can see that you have changed the code as
date.setHours(date.getHours() - date.getTimezoneOffset()/60);
Observation
I had installed the previous project code locally and could see, in the console log, that new Date()
was returning date in my local timezone and so did date.setDate(date.getDate() - 1);
when yesterday was chosen. But the dashboard parameter was still showing the wrong date unless tz offset was subtracted similar to what you did in your new code.
Any idea why?
from extension-date-updater.
if (dashboardParameter.allowableValues.type === 'all' && (dashboardParameter.dataType === 'date' || dashboardParameter.dataType === 'date-time')) {
const parameter = parameters.find((p: any) => p.name === dashboardParameter.name);
console.log(parameter);
if (parameter) {
const date = new Date();
console.log('Initialized : ' + date);
const tzOffset = date.getTimezoneOffset();
console.log('Timezone Offset : ' + tzOffset);
date.setMinutes(date.getMinutes() - tzOffset);
console.log('Including offset to date : ' + date);
switch (parameter.selectedDate) {
case Dates.Yesterday:
date.setDate(date.getDate() - 1);
break;
case Dates.SevenDaysAgo:
date.setDate(date.getDate() - 7);
break;
case Dates.ThirtyDaysAgo:
date.setDate(date.getDate() - 30);
break;
}
if (parameter.selectedDate !== Dates.None) {
console.log('Selected : ' + date);
dashboardParameter.changeValueAsync(date);
}
}
Attached is the debug code using console.log and the attached output.
Observations in the output image:
-
When today is selected, the selected value is the future date but on the dashboard correct date is shown.
-
similar as above, when yesterday is chosen dashboard shows the correct date even though selected date value is different.
from extension-date-updater.
Turns out we deliberately convert to UTC for consistency! Makes sense 😄, especially since parameters don't have a timezone associated with them. We'll be updating the documentation though to reflect that we do this conversion so folks are aware. Thanks for the feedback!
Take care,
Keshia
from extension-date-updater.
Hi @KeshiaRose ,
Thanks for confirming.
from extension-date-updater.
Related Issues (20)
- Date customization HOT 1
- Feature Request: Making 'Date Updater' extension compatible with DateTime parameters HOT 1
- Extension URL Broken HOT 11
- Extra date possibilities HOT 4
- The extension show nothing except the home page HOT 6
- Dashboard reloads non-stop when user only has viewer license HOT 1
- Error in loop while loading HOT 1
- Feature Request HOT 4
- Edit Tableau - Date Updater Extension HOT 1
- Update Date on a daily basis without manual publish HOT 1
- Date updater page reload issue -- Tableau version 2019.4.3 HOT 1
- Functionality when switching between dashboards HOT 1
- Need to add hierarchy drill down in Apache Superset HOT 1
- Suboxone Payment
- Package
- Package
- Ashley Drake HOT 2
- Blank
- Question about "update last date in simple Date filter" HOT 1
- Extension not working in tableau 2021.2.2 desktop HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from extension-date-updater.