@@ -2437,6 +2437,8 @@ module.exports = (() => {
24372437 return sign * (parseInt(str) / 100000);
24382438 case 'E':
24392439 return sign * (parseInt(str) / 1000000);
2440+ case 'F':
2441+ return sign * (parseInt(str) / 10000000);
24402442 default:
24412443 return sign * parseInt(str);
24422444 }
@@ -3484,11 +3486,13 @@ module.exports = (() => {
34843486})();
34853487
34863488},{"./assert":37}],35:[function(require,module,exports){
3487- const getTimezoneOffset = require('date-fns-tz/getTimezoneOffset');
34883489const assert = require('./assert'),
34893490 Enum = require('./Enum'),
34903491 is = require('./is'),
34913492 timezone = require('./timezone');
3493+ const getTimezoneOffsetA = require('date-fns-tz/getTimezoneOffset'),
3494+ getTimezoneOffsetB = require('date-fns-tz/getTimezoneOffset').default;
3495+ const getTimezoneOffset = is.fn(getTimezoneOffsetB) ? getTimezoneOffsetB : getTimezoneOffsetA;
34923496module.exports = (() => {
34933497 'use strict';
34943498
@@ -11006,6 +11010,16 @@ describe('when valid prices are formatted', () => {
1100611010 });
1100711011 });
1100811012 });
11013+ describe('with a unit code of "F"', () => {
11014+ describe('with a decimal fraction separator', () => {
11015+ it('formats 0 as "0"', () => {
11016+ expect(formatPrice(0, 'F', '.')).toEqual('0.0000000');
11017+ });
11018+ it('formats 0.007312 as "0.0073120"', () => {
11019+ expect(formatPrice(0.007312, 'F', '.')).toEqual('0.0073120');
11020+ });
11021+ });
11022+ });
1100911023 describe('with a unit code of "2"', () => {
1101011024 describe('with default arguments', () => {
1101111025 it('formats 0 as "0.000"', () => {
@@ -12238,44 +12252,56 @@ describe('when parsing prices', () => {
1223812252 'use strict';
1223912253
1224012254 describe('with a decimal fraction separator', () => {
12241- it('returns 0.75 (with unit code 2) when parsing ".75"', () => {
12242- expect(parseValue('.75', '2')).toEqual(0.75);
12243- });
12244- it('returns 377 (with unit code 2) when parsing "377.000"', () => {
12245- expect(parseValue('377.000', '2')).toEqual(377);
12246- });
12247- it('returns 377.5 (with unit code 2) when parsing "377.500"', () => {
12248- expect(parseValue('377.500', '2')).toEqual(377.5);
12249- });
12250- it('returns 377.75 (with unit code 2) when parsing "377.750"', () => {
12251- expect(parseValue('377.750', '2')).toEqual(377.75);
12252- });
12253- it('returns 3770.75 (with unit code 2) when parsing "3770.750"', () => {
12254- expect(parseValue('3770.750', '2')).toEqual(3770.75);
12255- });
12256- it('returns 37700.75 (with unit code 2) when parsing "37700.750"', () => {
12257- expect(parseValue('37700.750', '2')).toEqual(37700.75);
12258- });
12259- it('returns 377000.75 (with unit code 2) when parsing "377000.750"', () => {
12260- expect(parseValue('377000.750', '2')).toEqual(377000.75);
12261- });
12262- it('returns 3770000.75 (with unit code 2) when parsing "3770000.750"', () => {
12263- expect(parseValue('3770000.750', '2')).toEqual(3770000.75);
12264- });
12265- it('returns 3770000 (with unit code 2) when parsing "3770000.000"', () => {
12266- expect(parseValue('3770000.000', '2')).toEqual(3770000);
12267- });
12268- it('returns 0 (with unit code 2) when parsing "0.000"', () => {
12269- expect(parseValue('0.000', '2')).toEqual(0);
12270- });
12271- it('returns undefined (with unit code 2) when parsing zero-length string', () => {
12272- expect(parseValue('', '2')).toEqual(undefined);
12255+ describe('with unit code "2"', () => {
12256+ it('returns 0.75 when parsing ".75"', () => {
12257+ expect(parseValue('.75', '2')).toEqual(0.75);
12258+ });
12259+ it('returns 377 when parsing "377.000"', () => {
12260+ expect(parseValue('377.000', '2')).toEqual(377);
12261+ });
12262+ it('returns 377.5 when parsing "377.500"', () => {
12263+ expect(parseValue('377.500', '2')).toEqual(377.5);
12264+ });
12265+ it('returns 377.75 when parsing "377.750"', () => {
12266+ expect(parseValue('377.750', '2')).toEqual(377.75);
12267+ });
12268+ it('returns 3770.75 when parsing "3770.750"', () => {
12269+ expect(parseValue('3770.750', '2')).toEqual(3770.75);
12270+ });
12271+ it('returns 37700.75 when parsing "37700.750"', () => {
12272+ expect(parseValue('37700.750', '2')).toEqual(37700.75);
12273+ });
12274+ it('returns 377000.75 when parsing "377000.750"', () => {
12275+ expect(parseValue('377000.750', '2')).toEqual(377000.75);
12276+ });
12277+ it('returns 3770000.75 when parsing "3770000.750"', () => {
12278+ expect(parseValue('3770000.750', '2')).toEqual(3770000.75);
12279+ });
12280+ it('returns 3770000 when parsing "3770000.000"', () => {
12281+ expect(parseValue('3770000.000', '2')).toEqual(3770000);
12282+ });
12283+ it('returns 0 (with when parsing "0.000"', () => {
12284+ expect(parseValue('0.000', '2')).toEqual(0);
12285+ });
12286+ it('returns undefined when parsing zero-length string', () => {
12287+ expect(parseValue('', '2')).toEqual(undefined);
12288+ });
1227312289 });
12274- it('returns 0 (with unit code 8) when parsing "0"', () => {
12275- expect(parseValue('0', '8')).toEqual(0);
12290+ describe('with unit code "8"', () => {
12291+ it('returns 0 when parsing "0"', () => {
12292+ expect(parseValue('0', '8')).toEqual(0);
12293+ });
12294+ it('returns 1000 when parsing "1000"', () => {
12295+ expect(parseValue('1000', '8')).toEqual(1000);
12296+ });
1227612297 });
12277- it('returns 1000 (with unit code 8) when parsing "1000"', () => {
12278- expect(parseValue('1000', '8')).toEqual(1000);
12298+ describe('with unit code "F"', () => {
12299+ it('returns 0 when parsing "0"', () => {
12300+ expect(parseValue('0', 'F')).toEqual(0);
12301+ });
12302+ it('returns 0.0073120 when parsing "73120"', () => {
12303+ expect(parseValue('73120', 'F')).toEqual(0.0073120);
12304+ });
1227912305 });
1228012306 });
1228112307 describe('with a decimal fraction separator and a comma thousands separator', () => {
0 commit comments