Comments (2)
I've always dealt with timezones client side before passing the dates to ui modules. This is because there is so much work in dealing with timezones and every company I have worked for has dealt with them differently.
I will refer you to this video to hopefully entertain while also talking illustrating why dealing with timezones is a pain.
https://www.youtube.com/watch?v=-5wpm-gesOY
If you have any suggestions about how this module should deal with them please suggest. I am more than willing to add something if it is warranted.
from ng-bs-daterangepicker.
You're right, timezones are tricky, and that's, actually, the point in case of _date_rangepicker - we don't need timezones at all here. Correct me if I'm wrong, but use case for date range picker is to handle date ranges - say, when you book a hotel. We don't work with exact timestamps (well, maybe check-in/check-out times need to be specified, but that's more of application level logic).
If I select range "Sep 10 - Oct 10 ", I want exactly this date range to be stored and shown to all clients, regardless of their timezone. That fact that 'Sep 10 00:00:00' in my timezone is 'Sep 09 18:00:00' in another timezone should be irrelevant to date range picker.
My suggestion would be to always store startDate and endDate as UTC with 00:00:00 time, but it would be backward incompatible with people who use it already. So I'd suggest to make new option, something like 'utc' or 'forceUTC' and implement it this way, stepping out of time/timezone calculations completely and let user deal with their particular case.
Currently I use this ugly code to get 'correct' date timestamp:
var end = $scope.dateRange.endDate.toDate();
year = 1900 + end.getYear();
month = end.getMonth();
day = end.getDate();
var end_date = new Date(Date.UTC(year, month, day, 12, 00, 00));
But it's kinda sad :)
from ng-bs-daterangepicker.
Related Issues (20)
- ng-model notworking, when assigen iso-time string HOT 2
- How can i load the ng-bs-daterangepicker with custom values
- problem with initializing when using "." model binding HOT 2
- Version 0.0.5 to NPM HOT 2
- Add this small code, that helps so much.
- format is working properly when i try to bind with model
- Support for Angular 2.0
- updateInputText was removed in bootstrap-daterangepicker
- How to set default value for startDate and endDate HOT 1
- Default date range not working. HOT 7
- Error
- When selecting date I get in my input element text [object Object] instead of the actual date range HOT 1
- update to work with bootstrap-daterangepicker v2
- Can't see the tool bar next to calendar with options like last 7 days etc
- can not get the new value from $scope.$watch
- Today doesn't select HOT 1
- Independent start/end date selection
- Daterangepicker dropdown position at fixed div
- bootstrap4 responsive HOT 1
- Custom style.css media queries are not working in Bootstrap4 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 ng-bs-daterangepicker.