Some checks failed
Build & Deploy / 🔍 Prepare (push) Successful in 20s
Build & Deploy / 🧪 QA (push) Failing after 34s
Build & Deploy / 🏗️ Build (push) Has started running
Build & Deploy / 🚀 Deploy (push) Has been cancelled
Build & Deploy / 🧪 Smoke Test (push) Has been cancelled
Build & Deploy / ⚡ Lighthouse (push) Has been cancelled
Build & Deploy / 🔔 Notify (push) Has been cancelled
12 lines
498 B
Plaintext
12 lines
498 B
Plaintext
import { TZDate } from "../date/index.js";
|
|
|
|
/**
|
|
* The function creates accepts a time zone and returns a function that creates
|
|
* a new `TZDate` instance in the time zone from the provided value. Use it to
|
|
* provide the context for the date-fns functions, via the `in` option.
|
|
*
|
|
* @param timeZone - Time zone name (IANA or UTC offset)
|
|
*
|
|
* @returns Function that creates a new `TZDate` instance in the time zone
|
|
*/
|
|
export const tz = timeZone => value => TZDate.tz(timeZone, +new Date(value)); |