Skip to content

Commit

Permalink
Replace @elastic/datemath with @opensearch/datemath
Browse files Browse the repository at this point in the history
Signed-off-by: Matt Provost <provomat@amazon.com>
  • Loading branch information
BSFishy committed Jan 9, 2023
1 parent d9106be commit 5f9f417
Show file tree
Hide file tree
Showing 24 changed files with 703 additions and 57 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ yarn add @opensearch-project/oui
Note that OUI has [several `peerDependencies` requirements](package.json) that will also need to be installed if starting with a blank project. You can read more about other ways to [consume OUI][consuming].

```
yarn add @opensearch-project/oui @elastic/datemath moment prop-types
yarn add @opensearch-project/oui moment prop-types
```


Expand Down
64 changes: 32 additions & 32 deletions i18ntokens.json
Original file line number Diff line number Diff line change
Expand Up @@ -1861,12 +1861,12 @@
"start": {
"line": 146,
"column": 12,
"index": 4299
"index": 4302
},
"end": {
"line": 151,
"column": 62,
"index": 4513
"index": 4516
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1879,12 +1879,12 @@
"start": {
"line": 146,
"column": 12,
"index": 4299
"index": 4302
},
"end": {
"line": 151,
"column": 62,
"index": 4513
"index": 4516
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1897,12 +1897,12 @@
"start": {
"line": 170,
"column": 12,
"index": 5261
"index": 5264
},
"end": {
"line": 172,
"column": 43,
"index": 5365
"index": 5368
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1915,12 +1915,12 @@
"start": {
"line": 189,
"column": 8,
"index": 5904
"index": 5907
},
"end": {
"line": 192,
"column": 75,
"index": 6075
"index": 6078
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1933,12 +1933,12 @@
"start": {
"line": 210,
"column": 14,
"index": 6566
"index": 6569
},
"end": {
"line": 214,
"column": 16,
"index": 6757
"index": 6760
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand All @@ -1951,12 +1951,12 @@
"start": {
"line": 220,
"column": 12,
"index": 6907
"index": 6910
},
"end": {
"line": 224,
"column": 14,
"index": 7088
"index": 7091
}
},
"filepath": "src/components/date_picker/super_date_picker/date_popover/relative_tab.tsx"
Expand Down Expand Up @@ -1987,12 +1987,12 @@
"start": {
"line": 194,
"column": 8,
"index": 5693
"index": 5696
},
"end": {
"line": 196,
"column": 46,
"index": 5792
"index": 5795
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2005,12 +2005,12 @@
"start": {
"line": 213,
"column": 12,
"index": 6419
"index": 6422
},
"end": {
"line": 215,
"column": 37,
"index": 6519
"index": 6522
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2023,12 +2023,12 @@
"start": {
"line": 226,
"column": 16,
"index": 6926
"index": 6929
},
"end": {
"line": 228,
"column": 49,
"index": 7039
"index": 7042
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2041,12 +2041,12 @@
"start": {
"line": 241,
"column": 16,
"index": 7523
"index": 7526
},
"end": {
"line": 243,
"column": 45,
"index": 7628
"index": 7631
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2059,12 +2059,12 @@
"start": {
"line": 261,
"column": 12,
"index": 8244
"index": 8247
},
"end": {
"line": 261,
"column": 76,
"index": 8308
"index": 8311
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2077,12 +2077,12 @@
"start": {
"line": 276,
"column": 12,
"index": 8820
"index": 8823
},
"end": {
"line": 276,
"column": 76,
"index": 8884
"index": 8887
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2095,12 +2095,12 @@
"start": {
"line": 290,
"column": 12,
"index": 9356
"index": 9359
},
"end": {
"line": 290,
"column": 74,
"index": 9418
"index": 9421
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2113,12 +2113,12 @@
"start": {
"line": 311,
"column": 14,
"index": 10196
"index": 10199
},
"end": {
"line": 311,
"column": 76,
"index": 10258
"index": 10261
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand All @@ -2131,12 +2131,12 @@
"start": {
"line": 318,
"column": 12,
"index": 10451
"index": 10454
},
"end": {
"line": 326,
"column": 14,
"index": 10725
"index": 10728
}
},
"filepath": "src/components/date_picker/super_date_picker/quick_select_popover/quick_select.tsx"
Expand Down Expand Up @@ -2239,12 +2239,12 @@
"start": {
"line": 429,
"column": 14,
"index": 11259
"index": 11262
},
"end": {
"line": 432,
"column": 16,
"index": 11385
"index": 11388
}
},
"filepath": "src/components/date_picker/super_date_picker/super_date_picker.tsx"
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@
"@babel/preset-react": "^7.10.4",
"@babel/preset-typescript": "^7.12.1",
"@elastic/charts": "^30.2.0",
"@elastic/datemath": "^5.0.3",
"@elastic/eslint-config-kibana": "^0.15.0",
"@opensearch/datemath": "file:./packages/opensearch-datemath",
"@svgr/core": "5.4.0",
"@svgr/plugin-svgo": "^4.0.3",
"@types/classnames": "^2.2.10",
Expand Down Expand Up @@ -244,7 +244,6 @@
"yo": "^4.3.0"
},
"peerDependencies": {
"@elastic/datemath": "^5.0.2",
"@types/react": "^16.9.34",
"@types/react-dom": "^16.9.6",
"moment": "^2.13.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/opensearch-datemath/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/tsconfig.json
/__tests__
62 changes: 62 additions & 0 deletions packages/opensearch-datemath/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* The OpenSearch Contributors require contributions made to
* this file be licensed under the Apache-2.0 license or a
* compatible open source license.
*
* Any modifications Copyright OpenSearch Contributors. See
* GitHub history for details.
*/

/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import moment from 'moment';
export type Unit = 'ms' | 's' | 'm' | 'h' | 'd' | 'w' | 'M' | 'y';

declare const datemath: {
unitsMap: {
[k in Unit]: {
weight: number;
type: 'calendar' | 'fixed' | 'mixed';
base: number;
};
};
units: Unit[];
unitsAsc: Unit[];
unitsDesc: Unit[];

/**
* Parses a string into a moment object. The string can be something like "now - 15m".
* @param options.forceNow If this optional parameter is supplied, "now" will be treated as this
* date, rather than the real "now".
*/
parse(
input: string,
options?: {
roundUp?: boolean;
forceNow?: Date;
momentInstance?: typeof moment;
}
): moment.Moment | undefined;
};

// eslint-disable-next-line import/no-default-export
export default datemath;
Loading

0 comments on commit 5f9f417

Please sign in to comment.