@bbn/bbn 2.0.50 → 2.0.51

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/dt.d.ts CHANGED
@@ -1,8 +1,9 @@
1
+ import { Temporal } from 'temporal-polyfill';
1
2
  import bbnDtDateTime from './dt/classes/dateTime.js';
2
3
  import parse from './dt/functions/parse.js';
3
4
  import guessFormat from './dt/functions/guessFormat.js';
4
5
  declare const dt: {
5
- (value: any, inputFormat?: null | String): bbnDtDateTime;
6
+ (value: any, inputFormat?: null | String): bbnDtDateTime | Temporal.PlainDateTime | Temporal.Instant | Temporal.PlainDate | Temporal.PlainTime | Temporal.PlainYearMonth | Temporal.PlainMonthDay;
6
7
  locales: any;
7
8
  parse: typeof parse;
8
9
  guessFormat: typeof guessFormat;
package/dist/dt.js CHANGED
@@ -200,12 +200,12 @@ const dt = (value, inputFormat = null) => {
200
200
  }
201
201
  if (typeof value === 'string') {
202
202
  if (inputFormat) {
203
- v = parse(value, inputFormat);
203
+ return parse(value, inputFormat);
204
204
  }
205
205
  else {
206
206
  const format = guessFormat(value);
207
207
  if (format) {
208
- v = parse(value, format);
208
+ return parse(value, format);
209
209
  }
210
210
  else {
211
211
  throw new Error(_('Could not guess the date format for value: %s', value));
@@ -215,11 +215,11 @@ const dt = (value, inputFormat = null) => {
215
215
  else {
216
216
  if (typeof value === 'number') {
217
217
  const d = new Date(value);
218
- v = new bbnDtDateTime(d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
218
+ return new bbnDtDateTime(d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
219
219
  }
220
220
  else if (isDate(value)) {
221
221
  const d = value;
222
- v = new bbnDtDateTime(d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
222
+ return new bbnDtDateTime(d.getFullYear(), d.getMonth() + 1, d.getDate(), d.getHours(), d.getMinutes(), d.getSeconds(), d.getMilliseconds());
223
223
  }
224
224
  else if (isPrimitive(value)) {
225
225
  throw new Error(_('Invalid date value: %s', value));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bbn/bbn",
3
- "version": "2.0.50",
3
+ "version": "2.0.51",
4
4
  "description": "Javascript toolkit",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",