@carbon/utilities
Version:
Utilities and helpers to drive consistency across software products using the Carbon Design System
2 lines (1 loc) • 833 B
JavaScript
;var s=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var g=(t,r)=>{for(var e in r)s(t,e,{get:r[e],enumerable:!0})},p=(t,r,e,o)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of i(r))!y.call(t,n)&&n!==e&&s(t,n,{get:()=>r[n],enumerable:!(o=c(r,n))||o.enumerable});return t};var O=t=>p(s({},"__esModule",{value:!0}),t);var I={};g(I,{datePartsOrder:()=>x});module.exports=O(I);const h=new Map;function m(t){const r=h.get(t);if(r)return r;const e=new Intl.DateTimeFormat(t,{year:"numeric",month:"long"}).formatToParts(new Date(2e3,0,1)),o=e.findIndex(a=>a.type==="month"),n=e.findIndex(a=>a.type==="year"),d=o<n?"month-year":"year-month";return h.set(t,d),d}const f=t=>m(t)==="month-year",x={getMonthYearOrder:m,isMonthFirst:f};