useServerTime

⏲ The time is set up on the Mojito server. This hook is used to adjust the local time of the client, to display the same time/timers/dates across all time zones.

The useServerTime hook will call and return a response from the serverTime API.

Hooks Sample Code

...
import useServerTime from "mojito-hooks/useServerTime";


function App {
    const { serverTime } = useServerTime();

    // overwrite now() function to the server time
    moment.now = function () {
        return serverTime.getTime();
    };
}

Parameters

PropertyDescriptionType
usernameThe username to check.String

Result

PropertyDescriptionType
usernameAvailableReturn true or false for specified username.Boolean
checkUsernameFunction to check the username.(options: T) => Promise<U>
isLoadingDisplay request loading status, provided for convenience.Boolean
errorThe error object for the query, if an error was thrown.Error
queryResultOriginal React-Query query result.QueryResult<T>