Retrieve current date using users time zone from front end

Options

What is the easiest way to retrieve the CURRENT DATE from Xano using a User's timezone?

Best Answer

  • Ray Deck
    Ray Deck Trusted Xano Expert ✭✭✭
    Answer ✓
    Options

    The trick is getting the user's timezone. Either you need the user to select a timezone, or you can infer it from the request from the user by making the timezone part of your request. Depending on your platform, you can get the timezone from javascript with the following expression:

    Intl.DateTimeFormat().resolvedOptions().timeZone
    

    (try it in the console of your web browser using dev tools!)

Answers