@trsys-tech/matrix-library 0.5.0-beta.2 → 0.5.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/accordion.es.js.map +1 -1
- package/dist/avatar.es.js.map +1 -1
- package/dist/badge.es.js.map +1 -1
- package/dist/breadcrumb.es.js +4 -4
- package/dist/breadcrumb.es.js.map +1 -1
- package/dist/buildformatlongfn.es.js.map +1 -1
- package/dist/buildlocalizefn.es.js.map +1 -1
- package/dist/buildmatchfn.es.js.map +1 -1
- package/dist/buildmatchpatternfn.es.js.map +1 -1
- package/dist/button.es.js +3 -3
- package/dist/button.es.js.map +1 -1
- package/dist/calendar.es.js +3 -3
- package/dist/calendar.es.js.map +1 -1
- package/dist/card.es.js.map +1 -1
- package/dist/checkbox.es.js.map +1 -1
- package/dist/chip.es.js.map +1 -1
- package/dist/collapsible.es.js.map +1 -1
- package/dist/combobox.es.js +3 -3
- package/dist/combobox.es.js.map +1 -1
- package/dist/command.es.js.map +1 -1
- package/dist/components/command/Command.d.ts.map +1 -1
- package/dist/components/form/Form.d.ts +1 -1
- package/dist/components/form/Form.d.ts.map +1 -1
- package/dist/confirm.es.js.map +1 -1
- package/dist/contextmenu.es.js +4 -4
- package/dist/contextmenu.es.js.map +1 -1
- package/dist/dangercircleicon.es.js.map +1 -1
- package/dist/datagrid.es.js +6 -6
- package/dist/datagrid.es.js.map +1 -1
- package/dist/datepicker.es.js.map +1 -1
- package/dist/daterangepicker.es.js.map +1 -1
- package/dist/defaultoptions.es.js.map +1 -1
- package/dist/desktopdatepicker.es.js.map +1 -1
- package/dist/desktopdaterangepicker.es.js.map +1 -1
- package/dist/desktoptimepicker.es.js.map +1 -1
- package/dist/dialog.es.js.map +1 -1
- package/dist/differenceincalendardays.es.js.map +1 -1
- package/dist/drawer.es.js.map +1 -1
- package/dist/en-us.es.js.map +1 -1
- package/dist/form.es.js.map +1 -1
- package/dist/format.es.js.map +1 -1
- package/dist/formatdistance.es.js.map +1 -1
- package/dist/formatters.es.js +68 -2
- package/dist/formatters.es.js.map +1 -1
- package/dist/formcheckbox.es.js.map +1 -1
- package/dist/formcombobox.es.js.map +1 -1
- package/dist/formdatepicker.es.js.map +1 -1
- package/dist/formdaterangepicker.es.js.map +1 -1
- package/dist/forminput.es.js.map +1 -1
- package/dist/formmultiselect.es.js.map +1 -1
- package/dist/formrating.es.js.map +1 -1
- package/dist/formselect.es.js.map +1 -1
- package/dist/formswitch.es.js.map +1 -1
- package/dist/formtextarea.es.js.map +1 -1
- package/dist/formtimepicker.es.js.map +1 -1
- package/dist/getisoweekyear.es.js.map +1 -1
- package/dist/gettimezoneoffsetinmilliseconds.es.js.map +1 -1
- package/dist/getweekyear.es.js.map +1 -1
- package/dist/iconbutton.es.js +3 -3
- package/dist/iconbutton.es.js.map +1 -1
- package/dist/infocircleicon.es.js.map +1 -1
- package/dist/label.es.js.map +1 -1
- package/dist/lightformatters.es.js.map +1 -1
- package/dist/localize.es.js.map +1 -1
- package/dist/longformatters.es.js.map +1 -1
- package/dist/match.es.js.map +1 -1
- package/dist/mobiledatepicker.es.js.map +1 -1
- package/dist/mobiledaterangepicker.es.js.map +1 -1
- package/dist/mobiletimepicker.es.js.map +1 -1
- package/dist/modal.es.js.map +1 -1
- package/dist/multiselect.es.js +3 -3
- package/dist/multiselect.es.js.map +1 -1
- package/dist/normalizedates.es.js.map +1 -1
- package/dist/popover.es.js.map +1 -1
- package/dist/printhtml.es.js.map +1 -1
- package/dist/progress.es.js.map +1 -1
- package/dist/protectedtokens.es.js.map +1 -1
- package/dist/radiogroup.es.js.map +1 -1
- package/dist/rating.es.js.map +1 -1
- package/dist/select.es.js +3 -3
- package/dist/select.es.js.map +1 -1
- package/dist/sheet.es.js.map +1 -1
- package/dist/sidebar.es.js +6 -6
- package/dist/sidebar.es.js.map +1 -1
- package/dist/skeleton.es.js.map +1 -1
- package/dist/startofweek.es.js.map +1 -1
- package/dist/startofweekyear.es.js.map +1 -1
- package/dist/styles.css +1 -0
- package/dist/successcircleicon.es.js.map +1 -1
- package/dist/swipabledrawer.es.js.map +1 -1
- package/dist/switch.es.js.map +1 -1
- package/dist/tabs.es.js.map +1 -1
- package/dist/textarea.es.js.map +1 -1
- package/dist/textfield.es.js.map +1 -1
- package/dist/timepicker.es.js.map +1 -1
- package/dist/timepickercontent.es.js.map +1 -1
- package/dist/toast-components.es.js.map +1 -1
- package/dist/toast.es.js.map +1 -1
- package/dist/tooltip.es.js +2 -2
- package/dist/tooltip.es.js.map +1 -1
- package/dist/use-mobile.es.js.map +1 -1
- package/dist/use-toast.es.js.map +1 -1
- package/dist/utils.es.js.map +1 -1
- package/dist/warningcircleicon.es.js.map +1 -1
- package/package.json +9 -9
- package/dist/style.css +0 -1
package/dist/form.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form.es.js","sources":["../src/components/form/Form.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Controller, ControllerProps, FieldPath, FieldValues, FormProvider, useFormContext } from \"react-hook-form\";\n\nimport { Label } from \"../label/Label\";\nimport { cn } from \"../../lib/utils\";\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-1\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, React.ComponentPropsWithoutRef<\"label\">>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && \"text-danger\", \"block text-text-300\", className)} htmlFor={formItemId} {...props} />;\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<React.ElementRef<typeof Slot>, React.ComponentPropsWithoutRef<typeof Slot>>(({ className, ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n className={cn(className, error && \"border-danger hover:border-danger focus-visible:border-danger\")}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} id={formDescriptionId} className={cn(\"text-[0.8rem] text-muted-foreground\", className)} {...props} />;\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n // if (!body) {\n // return null;\n // }\n\n return (\n <p ref={ref} id={formMessageId} className={cn(\"text-[0.625rem] font-medium text-danger h-4\", className)} {...props}>\n {body ?? \" \"}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","jsx","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body"],"mappings":";;;;;;AASA,MAAMA,IAAOC,GAMPC,IAAmBC,EAAM,cAAqC,EAA2B,GAEzFC,IAAY,CAAkH;AAAA,EAClI,GAAGC;AACL,
|
|
1
|
+
{"version":3,"file":"form.es.js","sources":["../src/components/form/Form.tsx"],"sourcesContent":["\"use client\";\n\nimport * as React from \"react\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport { Controller, ControllerProps, FieldPath, FieldValues, FormProvider, useFormContext } from \"react-hook-form\";\n\nimport { Label } from \"../label/Label\";\nimport { cn } from \"../../lib/utils\";\n\nconst Form = FormProvider;\n\ntype FormFieldContextValue<TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>> = {\n name: TName;\n};\n\nconst FormFieldContext = React.createContext<FormFieldContextValue>({} as FormFieldContextValue);\n\nconst FormField = <TFieldValues extends FieldValues = FieldValues, TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>>({\n ...props\n}: ControllerProps<TFieldValues, TName>) => {\n return (\n <FormFieldContext.Provider value={{ name: props.name }}>\n <Controller {...props} />\n </FormFieldContext.Provider>\n );\n};\n\nconst useFormField = () => {\n const fieldContext = React.useContext(FormFieldContext);\n const itemContext = React.useContext(FormItemContext);\n const { getFieldState, formState } = useFormContext();\n\n const fieldState = getFieldState(fieldContext.name, formState);\n\n if (!fieldContext) {\n throw new Error(\"useFormField should be used within <FormField>\");\n }\n\n const { id } = itemContext;\n\n return {\n id,\n name: fieldContext.name,\n formItemId: `${id}-form-item`,\n formDescriptionId: `${id}-form-item-description`,\n formMessageId: `${id}-form-item-message`,\n ...fieldState,\n };\n};\n\ntype FormItemContextValue = {\n id: string;\n};\n\nconst FormItemContext = React.createContext<FormItemContextValue>({} as FormItemContextValue);\n\nconst FormItem = React.forwardRef<HTMLDivElement, React.HTMLAttributes<HTMLDivElement>>(({ className, ...props }, ref) => {\n const id = React.useId();\n\n return (\n <FormItemContext.Provider value={{ id }}>\n <div ref={ref} className={cn(\"space-y-1\", className)} {...props} />\n </FormItemContext.Provider>\n );\n});\nFormItem.displayName = \"FormItem\";\n\nconst FormLabel = React.forwardRef<HTMLLabelElement, React.ComponentPropsWithoutRef<\"label\">>(({ className, ...props }, ref) => {\n const { error, formItemId } = useFormField();\n\n return <Label ref={ref} className={cn(error && \"text-danger\", \"block text-text-300\", className)} htmlFor={formItemId} {...props} />;\n});\nFormLabel.displayName = \"FormLabel\";\n\nconst FormControl = React.forwardRef<React.ElementRef<typeof Slot>, React.ComponentPropsWithoutRef<typeof Slot>>(({ className, ...props }, ref) => {\n const { error, formItemId, formDescriptionId, formMessageId } = useFormField();\n\n return (\n <Slot\n ref={ref}\n id={formItemId}\n aria-describedby={!error ? `${formDescriptionId}` : `${formDescriptionId} ${formMessageId}`}\n aria-invalid={!!error}\n className={cn(className, error && \"border-danger hover:border-danger focus-visible:border-danger\")}\n {...props}\n />\n );\n});\nFormControl.displayName = \"FormControl\";\n\nconst FormDescription = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, ...props }, ref) => {\n const { formDescriptionId } = useFormField();\n\n return <p ref={ref} id={formDescriptionId} className={cn(\"text-[0.8rem] text-muted-foreground\", className)} {...props} />;\n});\nFormDescription.displayName = \"FormDescription\";\n\nconst FormMessage = React.forwardRef<HTMLParagraphElement, React.HTMLAttributes<HTMLParagraphElement>>(({ className, children, ...props }, ref) => {\n const { error, formMessageId } = useFormField();\n const body = error ? String(error?.message) : children;\n\n // if (!body) {\n // return null;\n // }\n\n return (\n <p ref={ref} id={formMessageId} className={cn(\"text-[0.625rem] font-medium text-danger h-4\", className)} {...props}>\n {body ?? \" \"}\n </p>\n );\n});\nFormMessage.displayName = \"FormMessage\";\n\nexport { Form, FormItem, FormLabel, FormControl, FormDescription, FormMessage, FormField };\n"],"names":["Form","FormProvider","FormFieldContext","React","FormField","props","jsx","Controller","useFormField","fieldContext","itemContext","FormItemContext","getFieldState","formState","useFormContext","fieldState","id","FormItem","className","ref","cn","FormLabel","error","formItemId","Label","FormControl","formDescriptionId","formMessageId","Slot","FormDescription","FormMessage","children","body"],"mappings":";;;;;;AASA,MAAMA,IAAOC,GAMPC,IAAmBC,EAAM,cAAqC,EAA2B,GAEzFC,IAAY,CAAkH;AAAA,EAClI,GAAGC;AACL,MAEI,gBAAAC,EAACJ,EAAiB,UAAjB,EAA0B,OAAO,EAAE,MAAMG,EAAM,KAAA,GAC9C,UAAA,gBAAAC,EAACC,GAAA,EAAY,GAAGF,GAAO,GACzB,GAIEG,IAAe,MAAM;AACzB,QAAMC,IAAeN,EAAM,WAAWD,CAAgB,GAChDQ,IAAcP,EAAM,WAAWQ,CAAe,GAC9C,EAAE,eAAAC,GAAe,WAAAC,EAAA,IAAcC,EAAA,GAE/BC,IAAaH,EAAcH,EAAa,MAAMI,CAAS;AAE7D,MAAI,CAACJ;AACH,UAAM,IAAI,MAAM,gDAAgD;AAGlE,QAAM,EAAE,IAAAO,MAAON;AAEf,SAAO;AAAA,IACL,IAAAM;AAAA,IACA,MAAMP,EAAa;AAAA,IACnB,YAAY,GAAGO,CAAE;AAAA,IACjB,mBAAmB,GAAGA,CAAE;AAAA,IACxB,eAAe,GAAGA,CAAE;AAAA,IACpB,GAAGD;AAAA,EAAA;AAEP,GAMMJ,IAAkBR,EAAM,cAAoC,EAA0B,GAEtFc,IAAWd,EAAM,WAAiE,CAAC,EAAE,WAAAe,GAAW,GAAGb,EAAA,GAASc,MAAQ;AACxH,QAAMH,IAAKb,EAAM,MAAA;AAEjB,2BACGQ,EAAgB,UAAhB,EAAyB,OAAO,EAAE,IAAAK,KACjC,UAAA,gBAAAV,EAAC,OAAA,EAAI,KAAAa,GAAU,WAAWC,EAAG,aAAaF,CAAS,GAAI,GAAGb,GAAO,GACnE;AAEJ,CAAC;AACDY,EAAS,cAAc;AAEvB,MAAMI,IAAYlB,EAAM,WAAsE,CAAC,EAAE,WAAAe,GAAW,GAAGb,EAAA,GAASc,MAAQ;AAC9H,QAAM,EAAE,OAAAG,GAAO,YAAAC,EAAA,IAAef,EAAA;AAE9B,SAAO,gBAAAF,EAACkB,GAAA,EAAM,KAAAL,GAAU,WAAWC,EAAGE,KAAS,eAAe,uBAAuBJ,CAAS,GAAG,SAASK,GAAa,GAAGlB,EAAA,CAAO;AACnI,CAAC;AACDgB,EAAU,cAAc;AAExB,MAAMI,IAActB,EAAM,WAAuF,CAAC,EAAE,WAAAe,GAAW,GAAGb,EAAA,GAASc,MAAQ;AACjJ,QAAM,EAAE,OAAAG,GAAO,YAAAC,GAAY,mBAAAG,GAAmB,eAAAC,EAAA,IAAkBnB,EAAA;AAEhE,SACE,gBAAAF;AAAA,IAACsB;AAAA,IAAA;AAAA,MACC,KAAAT;AAAA,MACA,IAAII;AAAA,MACJ,oBAAmBD,IAAiC,GAAGI,CAAiB,IAAIC,CAAa,KAA9D,GAAGD,CAAiB;AAAA,MAC/C,gBAAc,CAAC,CAACJ;AAAA,MAChB,WAAWF,EAAGF,GAAWI,KAAS,+DAA+D;AAAA,MAChG,GAAGjB;AAAA,IAAA;AAAA,EAAA;AAGV,CAAC;AACDoB,EAAY,cAAc;AAE1B,MAAMI,IAAkB1B,EAAM,WAA6E,CAAC,EAAE,WAAAe,GAAW,GAAGb,EAAA,GAASc,MAAQ;AAC3I,QAAM,EAAE,mBAAAO,EAAA,IAAsBlB,EAAA;AAE9B,SAAO,gBAAAF,EAAC,KAAA,EAAE,KAAAa,GAAU,IAAIO,GAAmB,WAAWN,EAAG,uCAAuCF,CAAS,GAAI,GAAGb,EAAA,CAAO;AACzH,CAAC;AACDwB,EAAgB,cAAc;AAE9B,MAAMC,IAAc3B,EAAM,WAA6E,CAAC,EAAE,WAAAe,GAAW,UAAAa,GAAU,GAAG1B,EAAA,GAASc,MAAQ;AACjJ,QAAM,EAAE,OAAAG,GAAO,eAAAK,EAAA,IAAkBnB,EAAA,GAC3BwB,IAAOV,IAAQ,OAAOA,GAAO,OAAO,IAAIS;AAM9C,SACE,gBAAAzB,EAAC,KAAA,EAAE,KAAAa,GAAU,IAAIQ,GAAe,WAAWP,EAAG,+CAA+CF,CAAS,GAAI,GAAGb,GAC1G,eAAQ,KACX;AAEJ,CAAC;AACDyB,EAAY,cAAc;"}
|
package/dist/format.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.es.js","sources":["../node_modules/date-fns/format.js"],"sourcesContent":["import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n"],"names":["formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","unescapedLatinCharacterRegExp","format","date","formatStr","options","defaultOptions","getDefaultOptions","locale","defaultLocale","firstWeekContainsDate","weekStartsOn","originalDate","toDate","isValid","parts","substring","firstCharacter","longFormatter","longFormatters","cleanEscapedString","formatters","formatterOptions","part","token","isProtectedWeekYearToken","isProtectedDayOfYearToken","warnOrThrowProtectedError","formatter","input","matched"],"mappings":";;;;;;;AA2BA,MAAMA,IACJ,yDAIIC,IAA6B,qCAE7BC,IAAsB,gBACtBC,IAAoB,OACpBC,IAAgC;AAoS/B,SAASC,EAAOC,GAAMC,GAAWC,GAAS;AAC/C,QAAMC,IAAiBC,EAAmB,GACpCC,IAA4BF,EAAe,UAAUG,GAErDC,IAGJJ,EAAe,yBACfA,EAAe,QAAQ,SAAS,yBAChC,GAEIK,IAGJL,EAAe,gBACfA,EAAe,QAAQ,SAAS,gBAChC,GAEIM,IAAeC,EAAOV,GAAME,GAAS,EAAE;AAE7C,MAAI,CAACS,EAAQF,CAAY;AACvB,UAAM,IAAI,WAAW,oBAAoB;AAG3C,MAAIG,IAAQX,EACT,MAAMN,CAA0B,EAChC,IAAI,CAACkB,MAAc;AAClB,UAAMC,IAAiBD,EAAU,CAAC;AAClC,QAAIC,MAAmB,OAAOA,MAAmB,KAAK;AACpD,YAAMC,IAAgBC,EAAeF,CAAc;AACnD,aAAOC,EAAcF,GAAWR,EAAO,UAAU;AAAA,IACzD;AACM,WAAOQ;AAAA,EACR,CAAA,EACA,KAAK,EAAE,EACP,MAAMnB,CAAsB,EAC5B,IAAI,CAACmB,MAAc;AAElB,QAAIA,MAAc;AAChB,aAAO,EAAE,SAAS,IAAO,OAAO,IAAK;AAGvC,UAAMC,IAAiBD,EAAU,CAAC;AAClC,QAAIC,MAAmB;AACrB,aAAO,EAAE,SAAS,IAAO,OAAOG,EAAmBJ,CAAS,EAAG;AAGjE,QAAIK,EAAWJ,CAAc;AAC3B,aAAO,EAAE,SAAS,IAAM,OAAOD,EAAW;AAG5C,QAAIC,EAAe,MAAMhB,CAA6B;AACpD,YAAM,IAAI;AAAA,QACR,mEACEgB,IACA;AAAA,MACH;AAGH,WAAO,EAAE,SAAS,IAAO,OAAOD,EAAW;AAAA,EACjD,CAAK;AAGH,EAAIR,EAAO,SAAS,iBAClBO,IAAQP,EAAO,SAAS,aAAaI,GAAcG,CAAK;AAG1D,QAAMO,IAAmB;AAAA,IACvB,uBAAAZ;AAAA,IACA,cAAAC;AAAA,IACA,QAAAH;AAAA,EACD;AAED,SAAOO,EACJ,IAAI,CAACQ,MAAS;AACb,QAAI,CAACA,EAAK,QAAS,QAAOA,EAAK;AAE/B,UAAMC,IAAQD,EAAK;AAEnB,KAEIE,EAAyBD,CAAK,KAE9BE,EAA0BF,CAAK,MAEjCG,EAA0BH,GAAOpB,GAAW,OAAOD,CAAI,CAAC;AAG1D,UAAMyB,IAAYP,EAAWG,EAAM,CAAC,CAAC;AACrC,WAAOI,EAAUhB,GAAcY,GAAOhB,EAAO,UAAUc,CAAgB;AAAA,EACxE,CAAA,EACA,KAAK,EAAE;AACZ;AAEA,SAASF,EAAmBS,GAAO;AACjC,QAAMC,IAAUD,EAAM,MAAM9B,CAAmB;AAE/C,SAAK+B,IAIEA,EAAQ,CAAC,EAAE,QAAQ9B,GAAmB,GAAG,IAHvC6B;AAIX;","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"format.es.js","sources":["../node_modules/date-fns/format.js"],"sourcesContent":["import { defaultLocale } from \"./_lib/defaultLocale.js\";\nimport { getDefaultOptions } from \"./_lib/defaultOptions.js\";\nimport { formatters } from \"./_lib/format/formatters.js\";\nimport { longFormatters } from \"./_lib/format/longFormatters.js\";\nimport {\n isProtectedDayOfYearToken,\n isProtectedWeekYearToken,\n warnOrThrowProtectedError,\n} from \"./_lib/protectedTokens.js\";\nimport { isValid } from \"./isValid.js\";\nimport { toDate } from \"./toDate.js\";\n\n// Rexports of internal for libraries to use.\n// See: https://github.com/date-fns/date-fns/issues/3638#issuecomment-1877082874\nexport { formatters, longFormatters };\n\n// This RegExp consists of three parts separated by `|`:\n// - [yYQqMLwIdDecihHKkms]o matches any available ordinal number token\n// (one of the certain letters followed by `o`)\n// - (\\w)\\1* matches any sequences of the same letter\n// - '' matches two quote characters in a row\n// - '(''|[^'])+('|$) matches anything surrounded by two quote characters ('),\n// except a single quote symbol, which ends the sequence.\n// Two quote characters do not end the sequence.\n// If there is no matching single quote\n// then the sequence will continue until the end of the string.\n// - . matches any single character unmatched by previous parts of the RegExps\nconst formattingTokensRegExp =\n /[yYQqMLwIdDecihHKkms]o|(\\w)\\1*|''|'(''|[^'])+('|$)|./g;\n\n// This RegExp catches symbols escaped by quotes, and also\n// sequences of symbols P, p, and the combinations like `PPPPPPPppppp`\nconst longFormattingTokensRegExp = /P+p+|P+|p+|''|'(''|[^'])+('|$)|./g;\n\nconst escapedStringRegExp = /^'([^]*?)'?$/;\nconst doubleQuoteRegExp = /''/g;\nconst unescapedLatinCharacterRegExp = /[a-zA-Z]/;\n\nexport { format as formatDate };\n\n/**\n * The {@link format} function options.\n */\n\n/**\n * @name format\n * @alias formatDate\n * @category Common Helpers\n * @summary Format the date.\n *\n * @description\n * Return the formatted date string in the given format. The result may vary by locale.\n *\n * > ⚠️ Please note that the `format` tokens differ from Moment.js and other libraries.\n * > See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * The characters wrapped between two single quotes characters (') are escaped.\n * Two single quotes in a row, whether inside or outside a quoted sequence, represent a 'real' single quote.\n * (see the last example)\n *\n * Format of the string is based on Unicode Technical Standard #35:\n * https://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table\n * with a few additions (see note 7 below the table).\n *\n * Accepted patterns:\n * | Unit | Pattern | Result examples | Notes |\n * |---------------------------------|---------|-----------------------------------|-------|\n * | Era | G..GGG | AD, BC | |\n * | | GGGG | Anno Domini, Before Christ | 2 |\n * | | GGGGG | A, B | |\n * | Calendar year | y | 44, 1, 1900, 2017 | 5 |\n * | | yo | 44th, 1st, 0th, 17th | 5,7 |\n * | | yy | 44, 01, 00, 17 | 5 |\n * | | yyy | 044, 001, 1900, 2017 | 5 |\n * | | yyyy | 0044, 0001, 1900, 2017 | 5 |\n * | | yyyyy | ... | 3,5 |\n * | Local week-numbering year | Y | 44, 1, 1900, 2017 | 5 |\n * | | Yo | 44th, 1st, 1900th, 2017th | 5,7 |\n * | | YY | 44, 01, 00, 17 | 5,8 |\n * | | YYY | 044, 001, 1900, 2017 | 5 |\n * | | YYYY | 0044, 0001, 1900, 2017 | 5,8 |\n * | | YYYYY | ... | 3,5 |\n * | ISO week-numbering year | R | -43, 0, 1, 1900, 2017 | 5,7 |\n * | | RR | -43, 00, 01, 1900, 2017 | 5,7 |\n * | | RRR | -043, 000, 001, 1900, 2017 | 5,7 |\n * | | RRRR | -0043, 0000, 0001, 1900, 2017 | 5,7 |\n * | | RRRRR | ... | 3,5,7 |\n * | Extended year | u | -43, 0, 1, 1900, 2017 | 5 |\n * | | uu | -43, 01, 1900, 2017 | 5 |\n * | | uuu | -043, 001, 1900, 2017 | 5 |\n * | | uuuu | -0043, 0001, 1900, 2017 | 5 |\n * | | uuuuu | ... | 3,5 |\n * | Quarter (formatting) | Q | 1, 2, 3, 4 | |\n * | | Qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | QQ | 01, 02, 03, 04 | |\n * | | QQQ | Q1, Q2, Q3, Q4 | |\n * | | QQQQ | 1st quarter, 2nd quarter, ... | 2 |\n * | | QQQQQ | 1, 2, 3, 4 | 4 |\n * | Quarter (stand-alone) | q | 1, 2, 3, 4 | |\n * | | qo | 1st, 2nd, 3rd, 4th | 7 |\n * | | qq | 01, 02, 03, 04 | |\n * | | qqq | Q1, Q2, Q3, Q4 | |\n * | | qqqq | 1st quarter, 2nd quarter, ... | 2 |\n * | | qqqqq | 1, 2, 3, 4 | 4 |\n * | Month (formatting) | M | 1, 2, ..., 12 | |\n * | | Mo | 1st, 2nd, ..., 12th | 7 |\n * | | MM | 01, 02, ..., 12 | |\n * | | MMM | Jan, Feb, ..., Dec | |\n * | | MMMM | January, February, ..., December | 2 |\n * | | MMMMM | J, F, ..., D | |\n * | Month (stand-alone) | L | 1, 2, ..., 12 | |\n * | | Lo | 1st, 2nd, ..., 12th | 7 |\n * | | LL | 01, 02, ..., 12 | |\n * | | LLL | Jan, Feb, ..., Dec | |\n * | | LLLL | January, February, ..., December | 2 |\n * | | LLLLL | J, F, ..., D | |\n * | Local week of year | w | 1, 2, ..., 53 | |\n * | | wo | 1st, 2nd, ..., 53th | 7 |\n * | | ww | 01, 02, ..., 53 | |\n * | ISO week of year | I | 1, 2, ..., 53 | 7 |\n * | | Io | 1st, 2nd, ..., 53th | 7 |\n * | | II | 01, 02, ..., 53 | 7 |\n * | Day of month | d | 1, 2, ..., 31 | |\n * | | do | 1st, 2nd, ..., 31st | 7 |\n * | | dd | 01, 02, ..., 31 | |\n * | Day of year | D | 1, 2, ..., 365, 366 | 9 |\n * | | Do | 1st, 2nd, ..., 365th, 366th | 7 |\n * | | DD | 01, 02, ..., 365, 366 | 9 |\n * | | DDD | 001, 002, ..., 365, 366 | |\n * | | DDDD | ... | 3 |\n * | Day of week (formatting) | E..EEE | Mon, Tue, Wed, ..., Sun | |\n * | | EEEE | Monday, Tuesday, ..., Sunday | 2 |\n * | | EEEEE | M, T, W, T, F, S, S | |\n * | | EEEEEE | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | ISO day of week (formatting) | i | 1, 2, 3, ..., 7 | 7 |\n * | | io | 1st, 2nd, ..., 7th | 7 |\n * | | ii | 01, 02, ..., 07 | 7 |\n * | | iii | Mon, Tue, Wed, ..., Sun | 7 |\n * | | iiii | Monday, Tuesday, ..., Sunday | 2,7 |\n * | | iiiii | M, T, W, T, F, S, S | 7 |\n * | | iiiiii | Mo, Tu, We, Th, Fr, Sa, Su | 7 |\n * | Local day of week (formatting) | e | 2, 3, 4, ..., 1 | |\n * | | eo | 2nd, 3rd, ..., 1st | 7 |\n * | | ee | 02, 03, ..., 01 | |\n * | | eee | Mon, Tue, Wed, ..., Sun | |\n * | | eeee | Monday, Tuesday, ..., Sunday | 2 |\n * | | eeeee | M, T, W, T, F, S, S | |\n * | | eeeeee | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | Local day of week (stand-alone) | c | 2, 3, 4, ..., 1 | |\n * | | co | 2nd, 3rd, ..., 1st | 7 |\n * | | cc | 02, 03, ..., 01 | |\n * | | ccc | Mon, Tue, Wed, ..., Sun | |\n * | | cccc | Monday, Tuesday, ..., Sunday | 2 |\n * | | ccccc | M, T, W, T, F, S, S | |\n * | | cccccc | Mo, Tu, We, Th, Fr, Sa, Su | |\n * | AM, PM | a..aa | AM, PM | |\n * | | aaa | am, pm | |\n * | | aaaa | a.m., p.m. | 2 |\n * | | aaaaa | a, p | |\n * | AM, PM, noon, midnight | b..bb | AM, PM, noon, midnight | |\n * | | bbb | am, pm, noon, midnight | |\n * | | bbbb | a.m., p.m., noon, midnight | 2 |\n * | | bbbbb | a, p, n, mi | |\n * | Flexible day period | B..BBB | at night, in the morning, ... | |\n * | | BBBB | at night, in the morning, ... | 2 |\n * | | BBBBB | at night, in the morning, ... | |\n * | Hour [1-12] | h | 1, 2, ..., 11, 12 | |\n * | | ho | 1st, 2nd, ..., 11th, 12th | 7 |\n * | | hh | 01, 02, ..., 11, 12 | |\n * | Hour [0-23] | H | 0, 1, 2, ..., 23 | |\n * | | Ho | 0th, 1st, 2nd, ..., 23rd | 7 |\n * | | HH | 00, 01, 02, ..., 23 | |\n * | Hour [0-11] | K | 1, 2, ..., 11, 0 | |\n * | | Ko | 1st, 2nd, ..., 11th, 0th | 7 |\n * | | KK | 01, 02, ..., 11, 00 | |\n * | Hour [1-24] | k | 24, 1, 2, ..., 23 | |\n * | | ko | 24th, 1st, 2nd, ..., 23rd | 7 |\n * | | kk | 24, 01, 02, ..., 23 | |\n * | Minute | m | 0, 1, ..., 59 | |\n * | | mo | 0th, 1st, ..., 59th | 7 |\n * | | mm | 00, 01, ..., 59 | |\n * | Second | s | 0, 1, ..., 59 | |\n * | | so | 0th, 1st, ..., 59th | 7 |\n * | | ss | 00, 01, ..., 59 | |\n * | Fraction of second | S | 0, 1, ..., 9 | |\n * | | SS | 00, 01, ..., 99 | |\n * | | SSS | 000, 001, ..., 999 | |\n * | | SSSS | ... | 3 |\n * | Timezone (ISO-8601 w/ Z) | X | -08, +0530, Z | |\n * | | XX | -0800, +0530, Z | |\n * | | XXX | -08:00, +05:30, Z | |\n * | | XXXX | -0800, +0530, Z, +123456 | 2 |\n * | | XXXXX | -08:00, +05:30, Z, +12:34:56 | |\n * | Timezone (ISO-8601 w/o Z) | x | -08, +0530, +00 | |\n * | | xx | -0800, +0530, +0000 | |\n * | | xxx | -08:00, +05:30, +00:00 | 2 |\n * | | xxxx | -0800, +0530, +0000, +123456 | |\n * | | xxxxx | -08:00, +05:30, +00:00, +12:34:56 | |\n * | Timezone (GMT) | O...OOO | GMT-8, GMT+5:30, GMT+0 | |\n * | | OOOO | GMT-08:00, GMT+05:30, GMT+00:00 | 2 |\n * | Timezone (specific non-locat.) | z...zzz | GMT-8, GMT+5:30, GMT+0 | 6 |\n * | | zzzz | GMT-08:00, GMT+05:30, GMT+00:00 | 2,6 |\n * | Seconds timestamp | t | 512969520 | 7 |\n * | | tt | ... | 3,7 |\n * | Milliseconds timestamp | T | 512969520900 | 7 |\n * | | TT | ... | 3,7 |\n * | Long localized date | P | 04/29/1453 | 7 |\n * | | PP | Apr 29, 1453 | 7 |\n * | | PPP | April 29th, 1453 | 7 |\n * | | PPPP | Friday, April 29th, 1453 | 2,7 |\n * | Long localized time | p | 12:00 AM | 7 |\n * | | pp | 12:00:00 AM | 7 |\n * | | ppp | 12:00:00 AM GMT+2 | 7 |\n * | | pppp | 12:00:00 AM GMT+02:00 | 2,7 |\n * | Combination of date and time | Pp | 04/29/1453, 12:00 AM | 7 |\n * | | PPpp | Apr 29, 1453, 12:00:00 AM | 7 |\n * | | PPPppp | April 29th, 1453 at ... | 7 |\n * | | PPPPpppp| Friday, April 29th, 1453 at ... | 2,7 |\n * Notes:\n * 1. \"Formatting\" units (e.g. formatting quarter) in the default en-US locale\n * are the same as \"stand-alone\" units, but are different in some languages.\n * \"Formatting\" units are declined according to the rules of the language\n * in the context of a date. \"Stand-alone\" units are always nominative singular:\n *\n * `format(new Date(2017, 10, 6), 'do LLLL', {locale: cs}) //=> '6. listopad'`\n *\n * `format(new Date(2017, 10, 6), 'do MMMM', {locale: cs}) //=> '6. listopadu'`\n *\n * 2. Any sequence of the identical letters is a pattern, unless it is escaped by\n * the single quote characters (see below).\n * If the sequence is longer than listed in table (e.g. `EEEEEEEEEEE`)\n * the output will be the same as default pattern for this unit, usually\n * the longest one (in case of ISO weekdays, `EEEE`). Default patterns for units\n * are marked with \"2\" in the last column of the table.\n *\n * `format(new Date(2017, 10, 6), 'MMM') //=> 'Nov'`\n *\n * `format(new Date(2017, 10, 6), 'MMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMM') //=> 'N'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMM') //=> 'November'`\n *\n * `format(new Date(2017, 10, 6), 'MMMMMMM') //=> 'November'`\n *\n * 3. Some patterns could be unlimited length (such as `yyyyyyyy`).\n * The output will be padded with zeros to match the length of the pattern.\n *\n * `format(new Date(2017, 10, 6), 'yyyyyyyy') //=> '00002017'`\n *\n * 4. `QQQQQ` and `qqqqq` could be not strictly numerical in some locales.\n * These tokens represent the shortest form of the quarter.\n *\n * 5. The main difference between `y` and `u` patterns are B.C. years:\n *\n * | Year | `y` | `u` |\n * |------|-----|-----|\n * | AC 1 | 1 | 1 |\n * | BC 1 | 1 | 0 |\n * | BC 2 | 2 | -1 |\n *\n * Also `yy` always returns the last two digits of a year,\n * while `uu` pads single digit years to 2 characters and returns other years unchanged:\n *\n * | Year | `yy` | `uu` |\n * |------|------|------|\n * | 1 | 01 | 01 |\n * | 14 | 14 | 14 |\n * | 376 | 76 | 376 |\n * | 1453 | 53 | 1453 |\n *\n * The same difference is true for local and ISO week-numbering years (`Y` and `R`),\n * except local week-numbering years are dependent on `options.weekStartsOn`\n * and `options.firstWeekContainsDate` (compare [getISOWeekYear](https://date-fns.org/docs/getISOWeekYear)\n * and [getWeekYear](https://date-fns.org/docs/getWeekYear)).\n *\n * 6. Specific non-location timezones are currently unavailable in `date-fns`,\n * so right now these tokens fall back to GMT timezones.\n *\n * 7. These patterns are not in the Unicode Technical Standard #35:\n * - `i`: ISO day of week\n * - `I`: ISO week of year\n * - `R`: ISO week-numbering year\n * - `t`: seconds timestamp\n * - `T`: milliseconds timestamp\n * - `o`: ordinal number modifier\n * - `P`: long localized date\n * - `p`: long localized time\n *\n * 8. `YY` and `YYYY` tokens represent week-numbering years but they are often confused with years.\n * You should enable `options.useAdditionalWeekYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * 9. `D` and `DD` tokens represent days of the year but they are often confused with days of the month.\n * You should enable `options.useAdditionalDayOfYearTokens` to use them. See: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n *\n * @param date - The original date\n * @param format - The string of tokens\n * @param options - An object with options\n *\n * @returns The formatted date string\n *\n * @throws `date` must not be Invalid Date\n * @throws `options.locale` must contain `localize` property\n * @throws `options.locale` must contain `formatLong` property\n * @throws use `yyyy` instead of `YYYY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `yy` instead of `YY` for formatting years using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `d` instead of `D` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws use `dd` instead of `DD` for formatting days of the month using [format provided] to the input [input provided]; see: https://github.com/date-fns/date-fns/blob/master/docs/unicodeTokens.md\n * @throws format string contains an unescaped latin alphabet character\n *\n * @example\n * // Represent 11 February 2014 in middle-endian format:\n * const result = format(new Date(2014, 1, 11), 'MM/dd/yyyy')\n * //=> '02/11/2014'\n *\n * @example\n * // Represent 2 July 2014 in Esperanto:\n * import { eoLocale } from 'date-fns/locale/eo'\n * const result = format(new Date(2014, 6, 2), \"do 'de' MMMM yyyy\", {\n * locale: eoLocale\n * })\n * //=> '2-a de julio 2014'\n *\n * @example\n * // Escape string by single quote characters:\n * const result = format(new Date(2014, 6, 2, 15), \"h 'o''clock'\")\n * //=> \"3 o'clock\"\n */\nexport function format(date, formatStr, options) {\n const defaultOptions = getDefaultOptions();\n const locale = options?.locale ?? defaultOptions.locale ?? defaultLocale;\n\n const firstWeekContainsDate =\n options?.firstWeekContainsDate ??\n options?.locale?.options?.firstWeekContainsDate ??\n defaultOptions.firstWeekContainsDate ??\n defaultOptions.locale?.options?.firstWeekContainsDate ??\n 1;\n\n const weekStartsOn =\n options?.weekStartsOn ??\n options?.locale?.options?.weekStartsOn ??\n defaultOptions.weekStartsOn ??\n defaultOptions.locale?.options?.weekStartsOn ??\n 0;\n\n const originalDate = toDate(date, options?.in);\n\n if (!isValid(originalDate)) {\n throw new RangeError(\"Invalid time value\");\n }\n\n let parts = formatStr\n .match(longFormattingTokensRegExp)\n .map((substring) => {\n const firstCharacter = substring[0];\n if (firstCharacter === \"p\" || firstCharacter === \"P\") {\n const longFormatter = longFormatters[firstCharacter];\n return longFormatter(substring, locale.formatLong);\n }\n return substring;\n })\n .join(\"\")\n .match(formattingTokensRegExp)\n .map((substring) => {\n // Replace two single quote characters with one single quote character\n if (substring === \"''\") {\n return { isToken: false, value: \"'\" };\n }\n\n const firstCharacter = substring[0];\n if (firstCharacter === \"'\") {\n return { isToken: false, value: cleanEscapedString(substring) };\n }\n\n if (formatters[firstCharacter]) {\n return { isToken: true, value: substring };\n }\n\n if (firstCharacter.match(unescapedLatinCharacterRegExp)) {\n throw new RangeError(\n \"Format string contains an unescaped latin alphabet character `\" +\n firstCharacter +\n \"`\",\n );\n }\n\n return { isToken: false, value: substring };\n });\n\n // invoke localize preprocessor (only for french locales at the moment)\n if (locale.localize.preprocessor) {\n parts = locale.localize.preprocessor(originalDate, parts);\n }\n\n const formatterOptions = {\n firstWeekContainsDate,\n weekStartsOn,\n locale,\n };\n\n return parts\n .map((part) => {\n if (!part.isToken) return part.value;\n\n const token = part.value;\n\n if (\n (!options?.useAdditionalWeekYearTokens &&\n isProtectedWeekYearToken(token)) ||\n (!options?.useAdditionalDayOfYearTokens &&\n isProtectedDayOfYearToken(token))\n ) {\n warnOrThrowProtectedError(token, formatStr, String(date));\n }\n\n const formatter = formatters[token[0]];\n return formatter(originalDate, token, locale.localize, formatterOptions);\n })\n .join(\"\");\n}\n\nfunction cleanEscapedString(input) {\n const matched = input.match(escapedStringRegExp);\n\n if (!matched) {\n return input;\n }\n\n return matched[1].replace(doubleQuoteRegExp, \"'\");\n}\n\n// Fallback for modularized imports:\nexport default format;\n"],"names":["formattingTokensRegExp","longFormattingTokensRegExp","escapedStringRegExp","doubleQuoteRegExp","unescapedLatinCharacterRegExp","format","date","formatStr","options","defaultOptions","getDefaultOptions","locale","defaultLocale","firstWeekContainsDate","weekStartsOn","originalDate","toDate","isValid","parts","substring","firstCharacter","longFormatter","longFormatters","cleanEscapedString","formatters","formatterOptions","part","token","isProtectedWeekYearToken","isProtectedDayOfYearToken","warnOrThrowProtectedError","formatter","input","matched"],"mappings":";;;;;;;AA2BA,MAAMA,IACJ,yDAIIC,IAA6B,qCAE7BC,IAAsB,gBACtBC,IAAoB,OACpBC,IAAgC;AAoS/B,SAASC,EAAOC,GAAMC,GAAWC,GAAS;AAC/C,QAAMC,IAAiBC,EAAiB,GAClCC,IAA4BF,EAAe,UAAUG,GAErDC,IAGJJ,EAAe,yBACfA,EAAe,QAAQ,SAAS,yBAChC,GAEIK,IAGJL,EAAe,gBACfA,EAAe,QAAQ,SAAS,gBAChC,GAEIM,IAAeC,EAAOV,GAAME,GAAS,EAAE;AAE7C,MAAI,CAACS,EAAQF,CAAY;AACvB,UAAM,IAAI,WAAW,oBAAoB;AAG3C,MAAIG,IAAQX,EACT,MAAMN,CAA0B,EAChC,IAAI,CAACkB,MAAc;AAClB,UAAMC,IAAiBD,EAAU,CAAC;AAClC,QAAIC,MAAmB,OAAOA,MAAmB,KAAK;AACpD,YAAMC,IAAgBC,EAAeF,CAAc;AACnD,aAAOC,EAAcF,GAAWR,EAAO,UAAU;AAAA,IACnD;AACA,WAAOQ;AAAA,EACT,CAAC,EACA,KAAK,EAAE,EACP,MAAMnB,CAAsB,EAC5B,IAAI,CAACmB,MAAc;AAElB,QAAIA,MAAc;AAChB,aAAO,EAAE,SAAS,IAAO,OAAO,IAAG;AAGrC,UAAMC,IAAiBD,EAAU,CAAC;AAClC,QAAIC,MAAmB;AACrB,aAAO,EAAE,SAAS,IAAO,OAAOG,EAAmBJ,CAAS,EAAC;AAG/D,QAAIK,EAAWJ,CAAc;AAC3B,aAAO,EAAE,SAAS,IAAM,OAAOD,EAAS;AAG1C,QAAIC,EAAe,MAAMhB,CAA6B;AACpD,YAAM,IAAI;AAAA,QACR,mEACEgB,IACA;AAAA,MACZ;AAGM,WAAO,EAAE,SAAS,IAAO,OAAOD,EAAS;AAAA,EAC3C,CAAC;AAGH,EAAIR,EAAO,SAAS,iBAClBO,IAAQP,EAAO,SAAS,aAAaI,GAAcG,CAAK;AAG1D,QAAMO,IAAmB;AAAA,IACvB,uBAAAZ;AAAA,IACA,cAAAC;AAAA,IACA,QAAAH;AAAA,EACJ;AAEE,SAAOO,EACJ,IAAI,CAACQ,MAAS;AACb,QAAI,CAACA,EAAK,QAAS,QAAOA,EAAK;AAE/B,UAAMC,IAAQD,EAAK;AAEnB,KAEIE,EAAyBD,CAAK,KAE9BE,EAA0BF,CAAK,MAEjCG,EAA0BH,GAAOpB,GAAW,OAAOD,CAAI,CAAC;AAG1D,UAAMyB,IAAYP,EAAWG,EAAM,CAAC,CAAC;AACrC,WAAOI,EAAUhB,GAAcY,GAAOhB,EAAO,UAAUc,CAAgB;AAAA,EACzE,CAAC,EACA,KAAK,EAAE;AACZ;AAEA,SAASF,EAAmBS,GAAO;AACjC,QAAMC,IAAUD,EAAM,MAAM9B,CAAmB;AAE/C,SAAK+B,IAIEA,EAAQ,CAAC,EAAE,QAAQ9B,GAAmB,GAAG,IAHvC6B;AAIX;","x_google_ignoreList":[0]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatdistance.es.js","sources":["../node_modules/date-fns/locale/en-US/_lib/formatDistance.js"],"sourcesContent":["const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n"],"names":["formatDistanceLocale","formatDistance","token","count","options","result","tokenValue"],"mappings":"AAAA,MAAMA,IAAuB;AAAA,EAC3B,kBAAkB;AAAA,IAChB,KAAK;AAAA,IACL,OAAO;AAAA,
|
|
1
|
+
{"version":3,"file":"formatdistance.es.js","sources":["../node_modules/date-fns/locale/en-US/_lib/formatDistance.js"],"sourcesContent":["const formatDistanceLocale = {\n lessThanXSeconds: {\n one: \"less than a second\",\n other: \"less than {{count}} seconds\",\n },\n\n xSeconds: {\n one: \"1 second\",\n other: \"{{count}} seconds\",\n },\n\n halfAMinute: \"half a minute\",\n\n lessThanXMinutes: {\n one: \"less than a minute\",\n other: \"less than {{count}} minutes\",\n },\n\n xMinutes: {\n one: \"1 minute\",\n other: \"{{count}} minutes\",\n },\n\n aboutXHours: {\n one: \"about 1 hour\",\n other: \"about {{count}} hours\",\n },\n\n xHours: {\n one: \"1 hour\",\n other: \"{{count}} hours\",\n },\n\n xDays: {\n one: \"1 day\",\n other: \"{{count}} days\",\n },\n\n aboutXWeeks: {\n one: \"about 1 week\",\n other: \"about {{count}} weeks\",\n },\n\n xWeeks: {\n one: \"1 week\",\n other: \"{{count}} weeks\",\n },\n\n aboutXMonths: {\n one: \"about 1 month\",\n other: \"about {{count}} months\",\n },\n\n xMonths: {\n one: \"1 month\",\n other: \"{{count}} months\",\n },\n\n aboutXYears: {\n one: \"about 1 year\",\n other: \"about {{count}} years\",\n },\n\n xYears: {\n one: \"1 year\",\n other: \"{{count}} years\",\n },\n\n overXYears: {\n one: \"over 1 year\",\n other: \"over {{count}} years\",\n },\n\n almostXYears: {\n one: \"almost 1 year\",\n other: \"almost {{count}} years\",\n },\n};\n\nexport const formatDistance = (token, count, options) => {\n let result;\n\n const tokenValue = formatDistanceLocale[token];\n if (typeof tokenValue === \"string\") {\n result = tokenValue;\n } else if (count === 1) {\n result = tokenValue.one;\n } else {\n result = tokenValue.other.replace(\"{{count}}\", count.toString());\n }\n\n if (options?.addSuffix) {\n if (options.comparison && options.comparison > 0) {\n return \"in \" + result;\n } else {\n return result + \" ago\";\n }\n }\n\n return result;\n};\n"],"names":["formatDistanceLocale","formatDistance","token","count","options","result","tokenValue"],"mappings":"AAAA,MAAMA,IAAuB;AAAA,EAC3B,kBAAkB;AAAA,IAChB,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,UAAU;AAAA,IACR,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,aAAa;AAAA,EAEb,kBAAkB;AAAA,IAChB,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,UAAU;AAAA,IACR,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,aAAa;AAAA,IACX,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,OAAO;AAAA,IACL,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,aAAa;AAAA,IACX,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,SAAS;AAAA,IACP,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,aAAa;AAAA,IACX,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,QAAQ;AAAA,IACN,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,YAAY;AAAA,IACV,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AAAA,EAEE,cAAc;AAAA,IACZ,KAAK;AAAA,IACL,OAAO;AAAA,EACX;AACA,GAEaC,IAAiB,CAACC,GAAOC,GAAOC,MAAY;AACvD,MAAIC;AAEJ,QAAMC,IAAaN,EAAqBE,CAAK;AAS7C,SARI,OAAOI,KAAe,WACxBD,IAASC,IACAH,MAAU,IACnBE,IAASC,EAAW,MAEpBD,IAASC,EAAW,MAAM,QAAQ,aAAaH,EAAM,UAAU,GAG7DC,GAAS,YACPA,EAAQ,cAAcA,EAAQ,aAAa,IACtC,QAAQC,IAERA,IAAS,SAIbA;AACT;","x_google_ignoreList":[0]}
|
package/dist/formatters.es.js
CHANGED
|
@@ -6,8 +6,6 @@ import { getWeekYear as x } from "./getweekyear.es.js";
|
|
|
6
6
|
import { addLeadingZeros as i } from "./addleadingzeros.es.js";
|
|
7
7
|
import { lightFormatters as u } from "./lightformatters.es.js";
|
|
8
8
|
const s = {
|
|
9
|
-
am: "am",
|
|
10
|
-
pm: "pm",
|
|
11
9
|
midnight: "midnight",
|
|
12
10
|
noon: "noon",
|
|
13
11
|
morning: "morning",
|
|
@@ -19,12 +17,15 @@ const s = {
|
|
|
19
17
|
G: function(n, r, e) {
|
|
20
18
|
const t = n.getFullYear() > 0 ? 1 : 0;
|
|
21
19
|
switch (r) {
|
|
20
|
+
// AD, BC
|
|
22
21
|
case "G":
|
|
23
22
|
case "GG":
|
|
24
23
|
case "GGG":
|
|
25
24
|
return e.era(t, { width: "abbreviated" });
|
|
25
|
+
// A, B
|
|
26
26
|
case "GGGGG":
|
|
27
27
|
return e.era(t, { width: "narrow" });
|
|
28
|
+
// Anno Domini, Before Christ
|
|
28
29
|
case "GGGG":
|
|
29
30
|
default:
|
|
30
31
|
return e.era(t, { width: "wide" });
|
|
@@ -69,22 +70,28 @@ const s = {
|
|
|
69
70
|
Q: function(n, r, e) {
|
|
70
71
|
const t = Math.ceil((n.getMonth() + 1) / 3);
|
|
71
72
|
switch (r) {
|
|
73
|
+
// 1, 2, 3, 4
|
|
72
74
|
case "Q":
|
|
73
75
|
return String(t);
|
|
76
|
+
// 01, 02, 03, 04
|
|
74
77
|
case "QQ":
|
|
75
78
|
return i(t, 2);
|
|
79
|
+
// 1st, 2nd, 3rd, 4th
|
|
76
80
|
case "Qo":
|
|
77
81
|
return e.ordinalNumber(t, { unit: "quarter" });
|
|
82
|
+
// Q1, Q2, Q3, Q4
|
|
78
83
|
case "QQQ":
|
|
79
84
|
return e.quarter(t, {
|
|
80
85
|
width: "abbreviated",
|
|
81
86
|
context: "formatting"
|
|
82
87
|
});
|
|
88
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
83
89
|
case "QQQQQ":
|
|
84
90
|
return e.quarter(t, {
|
|
85
91
|
width: "narrow",
|
|
86
92
|
context: "formatting"
|
|
87
93
|
});
|
|
94
|
+
// 1st quarter, 2nd quarter, ...
|
|
88
95
|
case "QQQQ":
|
|
89
96
|
default:
|
|
90
97
|
return e.quarter(t, {
|
|
@@ -97,22 +104,28 @@ const s = {
|
|
|
97
104
|
q: function(n, r, e) {
|
|
98
105
|
const t = Math.ceil((n.getMonth() + 1) / 3);
|
|
99
106
|
switch (r) {
|
|
107
|
+
// 1, 2, 3, 4
|
|
100
108
|
case "q":
|
|
101
109
|
return String(t);
|
|
110
|
+
// 01, 02, 03, 04
|
|
102
111
|
case "qq":
|
|
103
112
|
return i(t, 2);
|
|
113
|
+
// 1st, 2nd, 3rd, 4th
|
|
104
114
|
case "qo":
|
|
105
115
|
return e.ordinalNumber(t, { unit: "quarter" });
|
|
116
|
+
// Q1, Q2, Q3, Q4
|
|
106
117
|
case "qqq":
|
|
107
118
|
return e.quarter(t, {
|
|
108
119
|
width: "abbreviated",
|
|
109
120
|
context: "standalone"
|
|
110
121
|
});
|
|
122
|
+
// 1, 2, 3, 4 (narrow quarter; could be not numerical)
|
|
111
123
|
case "qqqqq":
|
|
112
124
|
return e.quarter(t, {
|
|
113
125
|
width: "narrow",
|
|
114
126
|
context: "standalone"
|
|
115
127
|
});
|
|
128
|
+
// 1st quarter, 2nd quarter, ...
|
|
116
129
|
case "qqqq":
|
|
117
130
|
default:
|
|
118
131
|
return e.quarter(t, {
|
|
@@ -128,18 +141,22 @@ const s = {
|
|
|
128
141
|
case "M":
|
|
129
142
|
case "MM":
|
|
130
143
|
return u.M(n, r);
|
|
144
|
+
// 1st, 2nd, ..., 12th
|
|
131
145
|
case "Mo":
|
|
132
146
|
return e.ordinalNumber(t + 1, { unit: "month" });
|
|
147
|
+
// Jan, Feb, ..., Dec
|
|
133
148
|
case "MMM":
|
|
134
149
|
return e.month(t, {
|
|
135
150
|
width: "abbreviated",
|
|
136
151
|
context: "formatting"
|
|
137
152
|
});
|
|
153
|
+
// J, F, ..., D
|
|
138
154
|
case "MMMMM":
|
|
139
155
|
return e.month(t, {
|
|
140
156
|
width: "narrow",
|
|
141
157
|
context: "formatting"
|
|
142
158
|
});
|
|
159
|
+
// January, February, ..., December
|
|
143
160
|
case "MMMM":
|
|
144
161
|
default:
|
|
145
162
|
return e.month(t, { width: "wide", context: "formatting" });
|
|
@@ -149,22 +166,28 @@ const s = {
|
|
|
149
166
|
L: function(n, r, e) {
|
|
150
167
|
const t = n.getMonth();
|
|
151
168
|
switch (r) {
|
|
169
|
+
// 1, 2, ..., 12
|
|
152
170
|
case "L":
|
|
153
171
|
return String(t + 1);
|
|
172
|
+
// 01, 02, ..., 12
|
|
154
173
|
case "LL":
|
|
155
174
|
return i(t + 1, 2);
|
|
175
|
+
// 1st, 2nd, ..., 12th
|
|
156
176
|
case "Lo":
|
|
157
177
|
return e.ordinalNumber(t + 1, { unit: "month" });
|
|
178
|
+
// Jan, Feb, ..., Dec
|
|
158
179
|
case "LLL":
|
|
159
180
|
return e.month(t, {
|
|
160
181
|
width: "abbreviated",
|
|
161
182
|
context: "standalone"
|
|
162
183
|
});
|
|
184
|
+
// J, F, ..., D
|
|
163
185
|
case "LLLLL":
|
|
164
186
|
return e.month(t, {
|
|
165
187
|
width: "narrow",
|
|
166
188
|
context: "standalone"
|
|
167
189
|
});
|
|
190
|
+
// January, February, ..., December
|
|
168
191
|
case "LLLL":
|
|
169
192
|
default:
|
|
170
193
|
return e.month(t, { width: "wide", context: "standalone" });
|
|
@@ -193,6 +216,7 @@ const s = {
|
|
|
193
216
|
E: function(n, r, e) {
|
|
194
217
|
const t = n.getDay();
|
|
195
218
|
switch (r) {
|
|
219
|
+
// Tue
|
|
196
220
|
case "E":
|
|
197
221
|
case "EE":
|
|
198
222
|
case "EEE":
|
|
@@ -200,16 +224,19 @@ const s = {
|
|
|
200
224
|
width: "abbreviated",
|
|
201
225
|
context: "formatting"
|
|
202
226
|
});
|
|
227
|
+
// T
|
|
203
228
|
case "EEEEE":
|
|
204
229
|
return e.day(t, {
|
|
205
230
|
width: "narrow",
|
|
206
231
|
context: "formatting"
|
|
207
232
|
});
|
|
233
|
+
// Tu
|
|
208
234
|
case "EEEEEE":
|
|
209
235
|
return e.day(t, {
|
|
210
236
|
width: "short",
|
|
211
237
|
context: "formatting"
|
|
212
238
|
});
|
|
239
|
+
// Tuesday
|
|
213
240
|
case "EEEE":
|
|
214
241
|
default:
|
|
215
242
|
return e.day(t, {
|
|
@@ -222,10 +249,13 @@ const s = {
|
|
|
222
249
|
e: function(n, r, e, t) {
|
|
223
250
|
const a = n.getDay(), o = (a - t.weekStartsOn + 8) % 7 || 7;
|
|
224
251
|
switch (r) {
|
|
252
|
+
// Numerical value (Nth day of week with current locale or weekStartsOn)
|
|
225
253
|
case "e":
|
|
226
254
|
return String(o);
|
|
255
|
+
// Padded numerical value
|
|
227
256
|
case "ee":
|
|
228
257
|
return i(o, 2);
|
|
258
|
+
// 1st, 2nd, ..., 7th
|
|
229
259
|
case "eo":
|
|
230
260
|
return e.ordinalNumber(o, { unit: "day" });
|
|
231
261
|
case "eee":
|
|
@@ -233,16 +263,19 @@ const s = {
|
|
|
233
263
|
width: "abbreviated",
|
|
234
264
|
context: "formatting"
|
|
235
265
|
});
|
|
266
|
+
// T
|
|
236
267
|
case "eeeee":
|
|
237
268
|
return e.day(a, {
|
|
238
269
|
width: "narrow",
|
|
239
270
|
context: "formatting"
|
|
240
271
|
});
|
|
272
|
+
// Tu
|
|
241
273
|
case "eeeeee":
|
|
242
274
|
return e.day(a, {
|
|
243
275
|
width: "short",
|
|
244
276
|
context: "formatting"
|
|
245
277
|
});
|
|
278
|
+
// Tuesday
|
|
246
279
|
case "eeee":
|
|
247
280
|
default:
|
|
248
281
|
return e.day(a, {
|
|
@@ -255,10 +288,13 @@ const s = {
|
|
|
255
288
|
c: function(n, r, e, t) {
|
|
256
289
|
const a = n.getDay(), o = (a - t.weekStartsOn + 8) % 7 || 7;
|
|
257
290
|
switch (r) {
|
|
291
|
+
// Numerical value (same as in `e`)
|
|
258
292
|
case "c":
|
|
259
293
|
return String(o);
|
|
294
|
+
// Padded numerical value
|
|
260
295
|
case "cc":
|
|
261
296
|
return i(o, r.length);
|
|
297
|
+
// 1st, 2nd, ..., 7th
|
|
262
298
|
case "co":
|
|
263
299
|
return e.ordinalNumber(o, { unit: "day" });
|
|
264
300
|
case "ccc":
|
|
@@ -266,16 +302,19 @@ const s = {
|
|
|
266
302
|
width: "abbreviated",
|
|
267
303
|
context: "standalone"
|
|
268
304
|
});
|
|
305
|
+
// T
|
|
269
306
|
case "ccccc":
|
|
270
307
|
return e.day(a, {
|
|
271
308
|
width: "narrow",
|
|
272
309
|
context: "standalone"
|
|
273
310
|
});
|
|
311
|
+
// Tu
|
|
274
312
|
case "cccccc":
|
|
275
313
|
return e.day(a, {
|
|
276
314
|
width: "short",
|
|
277
315
|
context: "standalone"
|
|
278
316
|
});
|
|
317
|
+
// Tuesday
|
|
279
318
|
case "cccc":
|
|
280
319
|
default:
|
|
281
320
|
return e.day(a, {
|
|
@@ -288,27 +327,34 @@ const s = {
|
|
|
288
327
|
i: function(n, r, e) {
|
|
289
328
|
const t = n.getDay(), a = t === 0 ? 7 : t;
|
|
290
329
|
switch (r) {
|
|
330
|
+
// 2
|
|
291
331
|
case "i":
|
|
292
332
|
return String(a);
|
|
333
|
+
// 02
|
|
293
334
|
case "ii":
|
|
294
335
|
return i(a, r.length);
|
|
336
|
+
// 2nd
|
|
295
337
|
case "io":
|
|
296
338
|
return e.ordinalNumber(a, { unit: "day" });
|
|
339
|
+
// Tue
|
|
297
340
|
case "iii":
|
|
298
341
|
return e.day(t, {
|
|
299
342
|
width: "abbreviated",
|
|
300
343
|
context: "formatting"
|
|
301
344
|
});
|
|
345
|
+
// T
|
|
302
346
|
case "iiiii":
|
|
303
347
|
return e.day(t, {
|
|
304
348
|
width: "narrow",
|
|
305
349
|
context: "formatting"
|
|
306
350
|
});
|
|
351
|
+
// Tu
|
|
307
352
|
case "iiiiii":
|
|
308
353
|
return e.day(t, {
|
|
309
354
|
width: "short",
|
|
310
355
|
context: "formatting"
|
|
311
356
|
});
|
|
357
|
+
// Tuesday
|
|
312
358
|
case "iiii":
|
|
313
359
|
default:
|
|
314
360
|
return e.day(t, {
|
|
@@ -439,13 +485,21 @@ const s = {
|
|
|
439
485
|
if (t === 0)
|
|
440
486
|
return "Z";
|
|
441
487
|
switch (r) {
|
|
488
|
+
// Hours and optional minutes
|
|
442
489
|
case "X":
|
|
443
490
|
return f(t);
|
|
491
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
492
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
493
|
+
// so this token always has the same output as `XX`
|
|
444
494
|
case "XXXX":
|
|
445
495
|
case "XX":
|
|
446
496
|
return c(t);
|
|
497
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
498
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
499
|
+
// so this token always has the same output as `XXX`
|
|
447
500
|
case "XXXXX":
|
|
448
501
|
case "XXX":
|
|
502
|
+
// Hours and minutes with `:` delimiter
|
|
449
503
|
default:
|
|
450
504
|
return c(t, ":");
|
|
451
505
|
}
|
|
@@ -454,13 +508,21 @@ const s = {
|
|
|
454
508
|
x: function(n, r, e) {
|
|
455
509
|
const t = n.getTimezoneOffset();
|
|
456
510
|
switch (r) {
|
|
511
|
+
// Hours and optional minutes
|
|
457
512
|
case "x":
|
|
458
513
|
return f(t);
|
|
514
|
+
// Hours, minutes and optional seconds without `:` delimiter
|
|
515
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
516
|
+
// so this token always has the same output as `xx`
|
|
459
517
|
case "xxxx":
|
|
460
518
|
case "xx":
|
|
461
519
|
return c(t);
|
|
520
|
+
// Hours, minutes and optional seconds with `:` delimiter
|
|
521
|
+
// Note: neither ISO-8601 nor JavaScript supports seconds in timezone offsets
|
|
522
|
+
// so this token always has the same output as `xxx`
|
|
462
523
|
case "xxxxx":
|
|
463
524
|
case "xxx":
|
|
525
|
+
// Hours and minutes with `:` delimiter
|
|
464
526
|
default:
|
|
465
527
|
return c(t, ":");
|
|
466
528
|
}
|
|
@@ -469,10 +531,12 @@ const s = {
|
|
|
469
531
|
O: function(n, r, e) {
|
|
470
532
|
const t = n.getTimezoneOffset();
|
|
471
533
|
switch (r) {
|
|
534
|
+
// Short
|
|
472
535
|
case "O":
|
|
473
536
|
case "OO":
|
|
474
537
|
case "OOO":
|
|
475
538
|
return "GMT" + d(t, ":");
|
|
539
|
+
// Long
|
|
476
540
|
case "OOOO":
|
|
477
541
|
default:
|
|
478
542
|
return "GMT" + c(t, ":");
|
|
@@ -482,10 +546,12 @@ const s = {
|
|
|
482
546
|
z: function(n, r, e) {
|
|
483
547
|
const t = n.getTimezoneOffset();
|
|
484
548
|
switch (r) {
|
|
549
|
+
// Short
|
|
485
550
|
case "z":
|
|
486
551
|
case "zz":
|
|
487
552
|
case "zzz":
|
|
488
553
|
return "GMT" + d(t, ":");
|
|
554
|
+
// Long
|
|
489
555
|
case "zzzz":
|
|
490
556
|
default:
|
|
491
557
|
return "GMT" + c(t, ":");
|