Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
actual-vt-capstone
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
danieljk
actual-vt-capstone
Commits
410dbbc8
Unverified
Commit
410dbbc8
authored
1 year ago
by
Sid Vishnoi
Committed by
GitHub
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
Add Indian numbering format (#1412)
parent
9273a0ab
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/loot-core/src/shared/util.test.ts
+10
-0
10 additions, 0 deletions
packages/loot-core/src/shared/util.test.ts
packages/loot-core/src/shared/util.ts
+6
-0
6 additions, 0 deletions
packages/loot-core/src/shared/util.ts
upcoming-release-notes/1412.md
+6
-0
6 additions, 0 deletions
upcoming-release-notes/1412.md
with
22 additions
and
0 deletions
packages/loot-core/src/shared/util.test.ts
+
10
−
0
View file @
410dbbc8
...
@@ -44,6 +44,16 @@ describe('utility functions', () => {
...
@@ -44,6 +44,16 @@ describe('utility functions', () => {
expect
(
formatter
.
format
(
Number
(
'
1234.56
'
))).
toBe
(
'
1,235
'
);
expect
(
formatter
.
format
(
Number
(
'
1234.56
'
))).
toBe
(
'
1,235
'
);
});
});
test
(
'
number formatting works with comma-dot-in format
'
,
()
=>
{
setNumberFormat
({
format
:
'
comma-dot-in
'
,
hideFraction
:
false
});
let
formatter
=
getNumberFormat
().
formatter
;
expect
(
formatter
.
format
(
Number
(
'
1234567.89
'
))).
toBe
(
'
12,34,567.89
'
);
setNumberFormat
({
format
:
'
comma-dot-in
'
,
hideFraction
:
true
});
formatter
=
getNumberFormat
().
formatter
;
expect
(
formatter
.
format
(
Number
(
'
1234567.89
'
))).
toBe
(
'
12,34,568
'
);
});
test
(
'
number formatting works with dot-comma format
'
,
()
=>
{
test
(
'
number formatting works with dot-comma format
'
,
()
=>
{
setNumberFormat
({
format
:
'
dot-comma
'
,
hideFraction
:
false
});
setNumberFormat
({
format
:
'
dot-comma
'
,
hideFraction
:
false
});
let
formatter
=
getNumberFormat
().
formatter
;
let
formatter
=
getNumberFormat
().
formatter
;
...
...
This diff is collapsed.
Click to expand it.
packages/loot-core/src/shared/util.ts
+
6
−
0
View file @
410dbbc8
...
@@ -188,6 +188,7 @@ export let numberFormats = [
...
@@ -188,6 +188,7 @@ export let numberFormats = [
{
value
:
'
dot-comma
'
,
label
:
'
1.000,33
'
,
labelNoFraction
:
'
1.000
'
},
{
value
:
'
dot-comma
'
,
label
:
'
1.000,33
'
,
labelNoFraction
:
'
1.000
'
},
{
value
:
'
space-comma
'
,
label
:
'
1 000,33
'
,
labelNoFraction
:
'
1 000
'
},
{
value
:
'
space-comma
'
,
label
:
'
1 000,33
'
,
labelNoFraction
:
'
1 000
'
},
{
value
:
'
space-dot
'
,
label
:
'
1 000.33
'
,
labelNoFraction
:
'
1 000
'
},
{
value
:
'
space-dot
'
,
label
:
'
1 000.33
'
,
labelNoFraction
:
'
1 000
'
},
{
value
:
'
comma-dot-in
'
,
label
:
'
1,00,000.33
'
,
labelNoFraction
:
'
1,00,000
'
},
]
as const
;
]
as const
;
let
numberFormat
:
{
let
numberFormat
:
{
...
@@ -220,6 +221,11 @@ export function setNumberFormat({ format, hideFraction }) {
...
@@ -220,6 +221,11 @@ export function setNumberFormat({ format, hideFraction }) {
regex
=
/
[^
-0-9.
]
/g
;
regex
=
/
[^
-0-9.
]
/g
;
separator
=
'
.
'
;
separator
=
'
.
'
;
break
;
break
;
case
'
comma-dot-in
'
:
locale
=
'
en-IN
'
;
regex
=
/
[^
-0-9.
]
/g
;
separator
=
'
.
'
;
break
;
case
'
comma-dot
'
:
case
'
comma-dot
'
:
default
:
default
:
locale
=
'
en-US
'
;
locale
=
'
en-US
'
;
...
...
This diff is collapsed.
Click to expand it.
upcoming-release-notes/1412.md
0 → 100644
+
6
−
0
View file @
410dbbc8
---
category
:
Enhancements
authors
:
[
sidvishnoi
]
---
Add Indian numbering format (lakh, crore)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment