Comments (7)
I think that’s fair enough, lets change date(d)
then to console.log(d)
so people don’t assume any side effects.
from tempo.
I didn't notice that you are using the viewer's current time, which happened to be 11:45 AM my time. Checked again & it's now 4:56 PM my time. I still think the example should always use a fixed time after 13:00 for illustrative purposes. I will not issue a PR at this time.
from tempo.
I am struggling to understand adding offset example
It says there is no offset, then it says +0100, and then after applying the offset the time stays the same at 9:30
can it have a bit more explanation or an extra example?
from tempo.
@justin-schroeder hello 👋
Main issue here is that is confusing to see 09:30
inside d
variable, and after applyOffset
we receive 09:30
too, this is because UTC
format, so I think that add console.log
for const d
is more then enough to see difference, or maybe something else to add for this?
![image](https://private-user-images.githubusercontent.com/82209198/307427598-2ef986fe-259c-4d96-9c4a-443c6ad941ae.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjMzNTM5NTAsIm5iZiI6MTcyMzM1MzY1MCwicGF0aCI6Ii84MjIwOTE5OC8zMDc0Mjc1OTgtMmVmOTg2ZmUtMjU5Yy00ZDk2LTljNGEtNDQzYzZhZDk0MWFlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTElMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODExVDA1MjA1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWI3OTJlMzcxNWM0NmMyYWE1NzFhNjEzYzBmYzBkMmZlOTE5M2MwODkwOTYyNDE1NjIzZmNiNWUwNzk0OGZhNjcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.hS_CHTO9gxrj2hU8ZxYjTrjiGO1u15FI6XcKMCsnEUY)
First we have 07:30 UTC
, and after applyOffset
with +0200, we receive 09:30 UTC
This question about second part of your comment #20 (comment):
- A few hard-coded times in the example.
from tempo.
I am struggling to understand adding offset example
It says there is no offset, then it says +0100, and then after applying the offset the time stays the same at 9:30
can it have a bit more explanation or an extra example?
@jeltehomminga the offset is essentially taking a time in your browser’s locale, and converting it to the same relative time (not absolute time) in the target location. This allows you to easily use normal Date
objects on your UI (which is much easier than normalizing everything to some remote tz) and then adjust it back to the target TZ at the end.
To use the car rental example, if someone wants to rent a car at 9:30am in lisbon, but their browser is in tokyo, how can we do that? This example is intended to demonstrate that you can create an interface (datepicker or otherwise) that allows the user to select their pickup time using local Date objects (9:30am tokyo time) and then the offset application converts that to 9:30am in Lisbon.
Hopefully that makes sense!
from tempo.
In the code example? Currently I believe it is uses your browser’s time, but I’d be happy to accept an PR to change this
from tempo.
Thanks for the great reply's. everything is clear now 👌🏼 The console log makes it much clearer for me indeed
from tempo.
Related Issues (20)
- Bugfix deviceTZ undefined case error HOT 3
- Unnecessary code in bundles HOT 5
- Are there any plans to support timezone formats like +-HH:mm in the parse function?
- Feature Request: Difference between datetimes HOT 1
- format YYYY-MM returns YYYY-M HOT 3
- yearStart and yearEnd may need to be added to types - v0.1.15 HOT 2
- Feature request: weekNumber HOT 8
- Feature request: `differenceInMilliseconds` / `differenceInSeconds` / `differenceInMinutes` / etc. HOT 1
- FeatureReuet: Support for timezone format +-HH:mm in format token. HOT 1
- Filtering out year still includes comma HOT 2
- Invalid offset error for +0000 HOT 2
- Optional argument in `is*` functions HOT 3
- Format with `a` or `A` are different locally vs CI HOT 2
- When user timezone is `Europe/Lisbon`, the tempo's `range` function throws an "Invalid offset" exception. HOT 6
- Feature Request : Duration format HOT 1
- Error: Invalid time zone specified: Etc/Unknown HOT 1
- Override the default timezone HOT 2
- "diffMinutes does not exist" error HOT 3
- Old timezones require second precision HOT 1
- Issue : format function throw error when locale passed including numbering system ( ar-u-nu-arab )
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 tempo.