@konomi-app/kintone-utilities 2.6.0 → 2.7.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/date.d.ts ADDED
@@ -0,0 +1,6 @@
1
+ export declare const getWareki: (date: Date, option?: {
2
+ era?: 'narrow' | 'short' | 'long';
3
+ }) => {
4
+ gengo: string;
5
+ year: number;
6
+ };
package/dist/date.js ADDED
@@ -0,0 +1,12 @@
1
+ export const getWareki = (date, option) => {
2
+ const { era = 'narrow' } = option || {};
3
+ const formatter = new Intl.DateTimeFormat('ja-JP-u-ca-japanese', { era });
4
+ const formatted = formatter.format(date);
5
+ const matched = formatted.match(/^(.*?)(\d+).*/);
6
+ if (!matched) {
7
+ throw '和暦情報のコンバートに失敗しました';
8
+ }
9
+ const [_, gengo, year] = matched;
10
+ return { gengo, year: Number(year) };
11
+ };
12
+ //# sourceMappingURL=date.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.js","sourceRoot":"","sources":["../src/date.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,IAAU,EACV,MAA8C,EACb,EAAE;IACnC,MAAM,EAAE,GAAG,GAAG,QAAQ,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;IAExC,MAAM,SAAS,GAAG,IAAI,IAAI,CAAC,cAAc,CAAC,qBAAqB,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;IAE1E,MAAM,SAAS,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACzC,MAAM,OAAO,GAAG,SAAS,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACjD,IAAI,CAAC,OAAO,EAAE;QACZ,MAAM,mBAAmB,CAAC;KAC3B;IAED,MAAM,CAAC,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,GAAG,OAAO,CAAC;IAEjC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC;AACvC,CAAC,CAAC"}
package/dist/index.d.ts CHANGED
@@ -6,3 +6,4 @@ export * from './rest-api';
6
6
  export * from './types/kintone.config';
7
7
  export * from './utilities';
8
8
  export * from './utility-types';
9
+ export * from './date';
package/dist/index.js CHANGED
@@ -5,4 +5,5 @@ export * from './rest-api';
5
5
  export * from './types/kintone.config';
6
6
  export * from './utilities';
7
7
  export * from './utility-types';
8
+ export * from './date';
8
9
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,wBAAwB,CAAC;AACvC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,QAAQ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@konomi-app/kintone-utilities",
3
- "version": "2.6.0",
3
+ "version": "2.7.0",
4
4
  "types": "dist/index.d.ts",
5
5
  "main": "dist/index.js",
6
6
  "repository": "https://github.com/local-bias/kintone-utilities.git",