@uiw/doc
Version:
UIW documentation website.
2 lines • 6.73 kB
JavaScript
(self.webpackChunkwebsite=self.webpackChunkwebsite||[]).push([[2993],{4934:e=>{function t(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}t.keys=()=>[],t.resolve=t,t.id=4934,e.exports=t},5301:(e,t,n)=>{"use strict";n.d(t,{Z:()=>f});var r=n(8573),o=n(6320),s=n(8563),a=n(7622),i=n(7937);const l={docinfo:"index_docinfo__3Vx8S",markdown:"index_markdown__hcQCp",markdownWrap:"index_markdownWrap__t60jR"};var c=n(4760);function m(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{path:t}=e,n=/^http/.test(t||"")?t:"https://github.com/uiwjs/uiw/blob/master/".concat(t);return(0,c.jsxs)("div",{className:l.docinfo,children:["\u72af\u4e86\u9519\u8bef\u8fd8\u662f\u60f3\u5bf9\u6587\u4ef6\u505a\u51fa\u8d21\u732e\uff1f",n&&(0,c.jsx)("a",{href:n,target:"_blank",rel:"noopener noreferrer",children:"\u5728Github\u4e0a\u7f16\u8f91\u672c\u9875\uff01"}),(0,c.jsx)("br",{}),(0,c.jsx)("a",{href:"https://github.com/uiwjs/uiw/issues",target:"_blank",rel:"noopener noreferrer",children:"\u53cd\u9988\u5efa\u8bae"}),(0,c.jsx)(i.Divider,{type:"vertical"}),(0,c.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/uiwjs/uiw/issues/new",children:"\u63d0\u4ea4bug"}),(0,c.jsx)(i.Divider,{type:"vertical"}),(0,c.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/uiwjs/uiw",children:"Github"}),(0,c.jsx)(i.Divider,{type:"vertical"}),(0,c.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/kktjs/kkt",children:"kkt"}),(0,c.jsx)(i.Divider,{type:"vertical"}),(0,c.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"https://github.com/kktjs/kkt-ssr",children:"@kkt/ssr"}),(0,c.jsx)(i.Divider,{type:"vertical"}),(0,c.jsx)("a",{target:"_blank",rel:"noopener noreferrer",href:"http://uiw.gitee.io",children:"\u56fd\u5185\u955c\u50cf"})]})}const d=o.ZP.Preview,p=o.ZP.Code,u=o.ZP.Toolbar,h=e=>{var t,n;let{node:a,components:i,data:l,...m}=e;const h=(0,r.useRef)(null),{headings:f,headingsList:w,...g}=m;(0,r.useEffect)((()=>{if(h.current){const e=h.current.parentElement;e&&e.parentElement&&e.parentElement.replaceChild(h.current,e)}}),[h]);const b=null===a||void 0===a||null===(t=a.position)||void 0===t?void 0:t.start.line,j=null===a||void 0===a||null===(n=a.data)||void 0===n?void 0:n.meta,v=(0,s.Mx)(j)||String(b),D=i["".concat(v)];if(v&&"function"===typeof D){const e=l[v].value||"",t=(0,s.aE)(j||"");return(0,c.jsxs)(o.ZP,{ref:h,children:[(0,c.jsx)(d,{style:{background:t.bg||"transparent"},children:(0,c.jsx)(D,{})}),(0,c.jsx)(u,{text:e,children:t.title||"Example"}),(0,c.jsx)(p,{children:(0,c.jsx)("pre",{...g})})]})}return(0,c.jsx)("code",{...g})};function f(e){return(0,c.jsxs)(r.Fragment,{children:[(0,c.jsx)(a.Z,{className:l.markdownWrap,source:e.source||"",disableCopy:!0,wrapperElement:{"data-color-mode":"light"},components:{code:t=>(0,c.jsx)(h,{...e,...t})}}),(0,c.jsx)(m,{path:e.path})]})}},5482:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});const r={components:{},data:{},source:"Formatter\n===\n\n[](https://github.com/uiwjs/date-formatter/actions/workflows/ci.yml) [](https://www.npmjs.com/package/@uiw/formatter) [](https://www.npmjs.com/package/@uiw/formatter)  [](https://coveralls.io/github/uiwjs/date-formatter?branch=master)\n[](https://www.npmjs.com/package/@uiw/formatter)\n\nGet a formatted date.\n\n[](https://codepen.io/jaywcjlove/pen/zbZKmq)\n[](https://codesandbox.io/s/date-formatter-demo-jib1u)\n\n### Install\n\n```bash\n$ npm install --save @uiw/formatter\n```\n\n### Usage\n\n```js\nimport formatter from '@uiw/formatter';\n\nconsole.log(formatter());\n//=> 2019-03-07\n\nconsole.log(formatter.utc());\n//=> 2019-03-07\n\nconsole.log(formatter('YYYY\u5e74MM\u6708DD\u65e5', new Date(2019, 3, 7)))\n//=> 2019\u5e7404\u670807\u65e5\nconsole.log(formatter('YYYY\u5e74MM\u6708DD\u65e5 16:30:29', new Date(2019, 3, 7, 16, 30, 29)))\n//=> 2019\u5e7404\u670807\u65e5 16:30:29\nconsole.log(formatter('YYYY\u5e74MM\u6708DD\u65e5 HH:mm-ss', new Date(2019, 3, 7, 16, 30, 29)))\n//=> 2019\u5e7404\u670807\u65e5 16:30-29\nconsole.log(formatter('YYYY/MM/DD HH:mm:ss', new Date(2019, 3, 7, 16, 30, 29)))\n//=> 2019\u5e7404\u670807\u65e5 16:30-29\nconsole.log(formatter('YYYY/MM/DD HH:mm:ss', new Date(2019, 3, 7, 16, 30, 29)))\n//=> 2019/04/07 16:30:29\n\n\nconsole.log(formatter('YYYY'));\n//=> 2019\nconsole.log(formatter.utc('YYYY'));\n//=> 2019\n```\n\nOr manually download and link **formatter.js** in your HTML, It can also be downloaded via [UNPKG](https://unpkg.com/@uiw/formatter):\n\n```html\n<div id=\"date\"></div>\n<script src=\"https://unpkg.com/@uiw/formatter/dist/formatter.min.js\"><\/script>\n<script>\n document.getElementById('date').innerHTML = formatter();\n<\/script>\n```\n\nThe above [example preview](https://codepen.io/jaywcjlove/pen/zbZKmq).\n\n### timeZoneConverter\n\nResolve changes in time zone, resulting in inaccurate display server time\n\n```js\nfunction timeZoneConverter(date, timeZone) {\n const oldDate = new Date(date);\n const newDate = new Date();\n const stamp = oldDate.getTime();\n if (!timeZone) return oldDate;\n return (isNaN(timeZone) && !timeZone)\n ? oldDate :\n new Date(stamp + (newDate.getTimezoneOffset() * 60 * 1000) + (timeZone * 60 * 60 * 1000));\n}\ntimeZoneConverter(new Date(1434701732*1000), 8)\n```\n\n## API\n\n```js\nformatter(rule: String, date: Date, utc: Boolean);\nformatter.utc(rule: String, date: Date);\n```\n\n## Supported Patterns\n\n| rule | Description | \u4e2d\u6587\u8bf4\u660e | E.g |\n|--------- |-------- |--------- |-------- |\n| `YYYY` | full year | \u5e74 | `2019` |\n| `MM` | month | \u6708 | `02` |\n| `DD` | day | \u5929 | `05` |\n| `HH` | hours | \u65f6 | `12` |\n| `mm` | minutes | \u5206\u949f | `59` |\n| `ss` | seconds | \u79d2 | `09` |\n| `ms` | milliseconds | \u6beb\u79d2 | `532` |\n",headings:[],headingsList:[]};var o=n(5301),s=n(4760);function a(){return(0,s.jsx)(o.Z,{...r,path:"https://github.com/uiwjs/date-formatter/blob/master/README.md"})}}}]);
//# sourceMappingURL=2993.bd1f43f2.chunk.js.map