Narcissistic Piano Mover

    adjust-timezone

    1.0.2 • Public • Published

    adjust-timezone

    This is for adjust date time while sending and receiving date time in different time zone

    Install

    $ npm i adjust-timezone

    Usage

    client-side: get timezone offset with getTimezoneOffset() and send to server woth API

    const clientOffset = new Date().getTimezoneOffset(); 
    const clientDate = from_client;

    Date from client to server then direction = 'CLIENT_TO_SERVER'

    Date from server to client then direction = 'SERVER_TO_CLIENT'

    Default direction = 'SERVER_TO_CLIENT'

    server-side: Send date time from client to server

    const { adjustTimezone } = require("adjust-timezone");
    
    const direction = 'CLIENT_TO_SERVER'
    const inServerTimeDate = adjustTimezone(clientDate, clientOffset, direction)

    server-side: Send date time from server to client

    const { adjustTimezone } = require("adjust-timezone");
    
    const direction = 'SERVER_TO_CLIENT'
    const inClientTimeDate = adjustTimezone(clientDate, clientOffset, direction)

    Keywords

    none

    Install

    npm i adjust-timezone

    DownloadsWeekly Downloads

    2

    Version

    1.0.2

    License

    ISC

    Unpacked Size

    3.88 kB

    Total Files

    6

    Last publish

    Collaborators

    • vipulvyas