Comments (4)
Let me elaborate on the issue.
I find this part of the api confusing, that is why I created the issue.
Most users are probably not aware of why this matters, or do not need the feature.
The usecase for providing a date when parsing an identity number I can think of is that you are parsing old data: The user entered the data with a hyphen when they were 99 years old and have since turned 100 which means the parsing will fail when performed at a later date. An edge case, but I can understand that we want to support this for completeness.
But the usecase for providing a date when calling ToString/ToShortString I do not really see. What is it I want to do at that point? βWhat would the string representation of this identity number be if I asked for it before this person turned 100β? Who wants to do that?
So I guess what I would like to propose is that if we consider the Parsing usecase to be important than we remove the overload without date and force the users of the api to always call it with a date. That way we make the users aware of the potential issue with people turning 100 after the string has been entered.
I think I prefer this solution the most actually. Let the users of the api create their own convenience method for calling our api with date = DateTime.UtcNow, so we don't hide the issue.
An alternative solution would be to not have this as an overloaded method, instead we name the method something else: ParseWithCustomDelimiterCutOffDate, or something shorter π
In any case we need to add some tests for this usecase.
For ToString/ToShortString I think we could do the same thing but since I think that usecase is weird, right now I would propose instead simply removing the overload that takes a date.
from activelogin.identity.
After some offline discussions we have decided to:
- Keep the data parameter both for
.To10DigitString()
and.Parse()
- Rename the parameter to make it more clear what it does, not it's only named
date
Suggestions of possible names?
from activelogin.identity.
Since only the year part matters maybe it makes sense to call the parameter
- currentYear
That's sort of what it is, right? CurrentYear for the execution of the method call, so to speak.
Otherwise
- decisionDate
- delimiterDecisionDate
from activelogin.identity.
Since only the year part matters maybe it makes sense to call the parameter
- currentYear
I like this! I've just created a PR.
from activelogin.identity.
Related Issues (20)
- Restructure samples HOT 2
- Dealing with too long README.md HOT 1
- Add tests for InvididualIdentityNumber HOT 1
- Remove FSharp API
- Remove Swedish-prefix from type names
- Update readme with respect to the new fsharp api
- Inequality operator not working as expected in C#
- Remove internal DomainError-types
- Create package with extensions for adding Testdata to Bogus HOT 2
- Update docs and implementation for Coordination Number HOT 3
- C# testdata returns FSharpList HOT 2
- Move SwedishPersonalIdentityNumberTestDataExtensions to the ActiveLogin.Identity.Swedish namespace
- Investigate serialization support HOT 3
- TestData causes docker container to crash
- Data validation in forms, data imports or similar HOT 10
- Unit test bug: For testing strict mode new invalid test data generators are needed
- CoordinationNumber does not exist in the nuget package? HOT 5
- Add new test numbers to the TestData nuget package HOT 2
- Add validation attribute for Coordination numbers HOT 2
- Remove Author signature of the NuGet packages
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from activelogin.identity.