Giter VIP home page Giter VIP logo

Comments (7)

justin-schroeder avatar justin-schroeder commented on August 11, 2024 2

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.

matthewadams avatar matthewadams commented on August 11, 2024 1

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.

jeltehomminga avatar jeltehomminga commented on August 11, 2024 1

I am struggling to understand adding offset example

CleanShot 2024-02-23 at 03 20 20@2x

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.

romanhrynevych avatar romanhrynevych commented on August 11, 2024 1

@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

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):

  1. A few hard-coded times in the example.

from tempo.

justin-schroeder avatar justin-schroeder commented on August 11, 2024 1

I am struggling to understand adding offset example

CleanShot 2024-02-23 at 03 20 20@2x

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.

justin-schroeder avatar justin-schroeder commented on August 11, 2024

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.

jeltehomminga avatar jeltehomminga commented on August 11, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.