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
23 lines
750 B
Plaintext
23 lines
750 B
Plaintext
/**
|
|
* Converts a UTC offset string to a GraphQL-safe enum name.
|
|
* Uses `_TZOFFSET_` prefix to avoid conflicts with user-defined enum values.
|
|
*
|
|
* Examples:
|
|
* - '+05:30' → '_TZOFFSET_PLUS_05_30'
|
|
* - '-08:00' → '_TZOFFSET_MINUS_08_00'
|
|
* - '+00:00' → '_TZOFFSET_PLUS_00_00'
|
|
*
|
|
* @returns The GraphQL-safe name, or null if not a UTC offset
|
|
*/ export const formatUtcOffset = (value)=>{
|
|
// Match UTC offset pattern: ±HH:mm
|
|
const match = value.match(/^([+-])(\d{2}):(\d{2})$/);
|
|
if (!match) {
|
|
return null;
|
|
}
|
|
const sign = match[1] === '+' ? 'PLUS' : 'MINUS';
|
|
const hours = match[2];
|
|
const minutes = match[3];
|
|
return `_TZOFFSET_${sign}_${hours}_${minutes}`;
|
|
};
|
|
|
|
//# sourceMappingURL=formatUtcOffset.js.map |