Skip to content

Commit f6258a9

Browse files
authored
Merge pull request #28 from cnblogs/add-today-api
feat: add Today() api
2 parents b6e5238 + b2969b9 commit f6258a9

File tree

4 files changed

+153
-102
lines changed

4 files changed

+153
-102
lines changed

.editorconfig

Lines changed: 132 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
root = true
12

23
[*]
3-
charset = utf-8-bom
4+
charset = utf-8
45
end_of_line = lf
5-
trim_trailing_whitespace = false
6-
insert_final_newline = false
6+
trim_trailing_whitespace = true
7+
insert_final_newline = true
78
indent_style = space
89
indent_size = 4
910

1011
# Microsoft .NET properties
11-
csharp_preferred_modifier_order = public, private, protected, internal, static, abstract, virtual, sealed, override, new, readonly, extern, unsafe, volatile, async:suggestion
12+
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:suggestion
1213
csharp_style_var_elsewhere = true:suggestion
1314
csharp_style_var_for_built_in_types = true:suggestion
1415
csharp_style_var_when_type_is_apparent = true:suggestion
@@ -22,9 +23,72 @@ dotnet_style_qualification_for_field = false:suggestion
2223
dotnet_style_qualification_for_method = false:suggestion
2324
dotnet_style_qualification_for_property = false:suggestion
2425
dotnet_style_require_accessibility_modifiers = for_non_interface_members:suggestion
26+
dotnet_sort_system_directives_first = true
27+
dotnet_style_readonly_field = true:suggestion
28+
29+
# Expression-level preferences
30+
dotnet_style_object_initializer = true:suggestion
31+
dotnet_style_collection_initializer = true:suggestion
32+
dotnet_style_explicit_tuple_names = true:suggestion
33+
dotnet_style_coalesce_expression = true:suggestion
34+
dotnet_style_null_propagation = true:suggestion
35+
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
36+
dotnet_style_prefer_inferred_tuple_names = true:suggestion
37+
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
38+
dotnet_style_prefer_auto_properties = true:suggestion
39+
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
40+
dotnet_style_prefer_conditional_expression_over_return = true:silent
41+
csharp_prefer_simple_default_expression = true:suggestion
42+
43+
# Expression-bodied members
44+
csharp_style_expression_bodied_methods = true:silent
45+
csharp_style_expression_bodied_constructors = true:silent
46+
csharp_style_expression_bodied_operators = true:silent
47+
csharp_style_expression_bodied_properties = true:silent
48+
csharp_style_expression_bodied_indexers = true:silent
49+
csharp_style_expression_bodied_accessors = true:silent
50+
csharp_style_expression_bodied_lambdas = true:silent
51+
csharp_style_expression_bodied_local_functions = true:silent
52+
53+
# Pattern matching
54+
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
55+
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
56+
csharp_style_inlined_variable_declaration = true:suggestion
57+
58+
# Null checking preferences
59+
csharp_style_throw_expression = true:suggestion
60+
csharp_style_conditional_delegate_call = true:suggestion
61+
62+
# Other features
63+
csharp_style_prefer_index_operator = false:none
64+
csharp_style_prefer_range_operator = false:none
65+
csharp_style_pattern_local_over_anonymous_function = false:none
66+
67+
# Space preferences
68+
csharp_space_after_cast = false
69+
csharp_space_after_colon_in_inheritance_clause = true
70+
csharp_space_after_comma = true
71+
csharp_space_after_dot = false
72+
csharp_space_after_keywords_in_control_flow_statements = true
73+
csharp_space_after_semicolon_in_for_statement = true
74+
csharp_space_around_binary_operators = before_and_after
75+
csharp_space_around_declaration_statements = false
76+
csharp_space_before_colon_in_inheritance_clause = true
77+
csharp_space_before_comma = false
78+
csharp_space_before_dot = false
79+
csharp_space_before_open_square_brackets = false
80+
csharp_space_before_semicolon_in_for_statement = false
81+
csharp_space_between_empty_square_brackets = false
82+
csharp_space_between_method_call_empty_parameter_list_parentheses = false
83+
csharp_space_between_method_call_name_and_opening_parenthesis = false
84+
csharp_space_between_method_call_parameter_list_parentheses = false
85+
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
86+
csharp_space_between_method_declaration_name_and_open_parenthesis = false
87+
csharp_space_between_method_declaration_parameter_list_parentheses = false
88+
csharp_space_between_parentheses = false
89+
csharp_space_between_square_brackets = false
2590

2691
# ReSharper properties
27-
resharper_autodetect_indent_settings = true
2892
resharper_braces_for_for = required
2993
resharper_braces_for_foreach = required
3094
resharper_braces_for_ifelse = required
@@ -45,39 +109,18 @@ resharper_keep_existing_initializer_arrangement = false
45109
resharper_keep_existing_invocation_parens_arrangement = false
46110
resharper_keep_existing_switch_expression_arrangement = false
47111
resharper_max_initializer_elements_on_line = 2
48-
resharper_modifiers_order = public private protected internal static abstract virtual sealed override new readonly extern unsafe volatile async
49112
resharper_place_accessorholder_attribute_on_same_line = false
50113
resharper_place_field_attribute_on_same_line = false
51114
resharper_place_linq_into_on_new_line = false
52115
resharper_place_simple_anonymousmethod_on_single_line = false
53116
resharper_place_simple_embedded_statement_on_same_line = false
54117
resharper_space_between_attribute_sections = false
55-
resharper_use_indent_from_vs = false
56118
resharper_wrap_before_arrow_with_expressions = true
57119
resharper_wrap_before_extends_colon = true
58120
resharper_wrap_before_linq_expression = true
59121
resharper_wrap_chained_binary_expressions = chop_if_long
60122

61123
# ReSharper inspection severities
62-
resharper_arrange_redundant_parentheses_highlighting = hint
63-
resharper_arrange_this_qualifier_highlighting = hint
64-
resharper_arrange_type_member_modifiers_highlighting = hint
65-
resharper_arrange_type_modifiers_highlighting = hint
66-
resharper_built_in_type_reference_style_for_member_access_highlighting = hint
67-
resharper_built_in_type_reference_style_highlighting = hint
68-
resharper_mvc_view_component_view_not_resolved_highlighting = none
69-
resharper_redundant_base_qualifier_highlighting = warning
70-
resharper_suggest_var_or_type_built_in_types_highlighting = hint
71-
resharper_suggest_var_or_type_elsewhere_highlighting = hint
72-
resharper_suggest_var_or_type_simple_types_highlighting = hint
73-
resharper_web_config_module_not_resolved_highlighting = warning
74-
resharper_web_config_type_not_resolved_highlighting = warning
75-
resharper_web_config_wrong_module_highlighting = warning
76-
77-
[*.{appxmanifest,asax,ascx,aspx,axaml,build,c,c++,cc,cginc,compute,cp,cpp,cs,cshtml,cu,cuh,cxx,dtd,fs,fsi,fsscript,fsx,fx,fxh,h,hh,hlsl,hlsli,hlslinc,hpp,hxx,inc,inl,ino,ipp,master,ml,mli,mpp,mq4,mq5,mqh,nuspec,paml,razor,resw,resx,skin,tpp,usf,ush,vb,xaml,xamlx,xoml,xsd}]
78-
indent_style = space
79-
indent_size = 4
80-
tab_width = 4
81124

82125
[*.{xml,csproj}]
83126
indent_size = 2
@@ -87,46 +130,37 @@ tab_width = 2
87130
[*.cs]
88131

89132
# var preferences
90-
csharp_style_var_elsewhere = false:silent
91-
csharp_style_var_for_built_in_types = false:silent
133+
csharp_style_var_elsewhere = false:suggestion
134+
csharp_style_var_for_built_in_types = false:suggestion
92135
csharp_style_var_when_type_is_apparent = false:silent
93136

94137
# Expression-bodied members
95-
csharp_style_expression_bodied_accessors = true:silent
96138
csharp_style_expression_bodied_constructors = false:silent
97-
csharp_style_expression_bodied_indexers = true:silent
98139
csharp_style_expression_bodied_lambdas = true:suggestion
99140
csharp_style_expression_bodied_local_functions = false:silent
100141
csharp_style_expression_bodied_methods = false:silent
101142
csharp_style_expression_bodied_operators = false:silent
102-
csharp_style_expression_bodied_properties = true:silent
103143

104144
# Pattern matching preferences
105-
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
106-
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
107145
csharp_style_prefer_not_pattern = true:suggestion
108146
csharp_style_prefer_pattern_matching = true:silent
109147
csharp_style_prefer_switch_expression = true:suggestion
110148

111149
# Null-checking preferences
112-
csharp_style_conditional_delegate_call = true:suggestion
113150

114151
# Modifier preferences
115-
csharp_prefer_static_local_function = true:warning
152+
csharp_prefer_static_local_function = true:suggestion
116153
csharp_preferred_modifier_order = public,private,protected,internal,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,volatile,async:silent
117154

118155
# Code-block preferences
119156
csharp_prefer_braces = true:silent
120-
csharp_prefer_simple_using_statement = true:suggestion
157+
csharp_prefer_simple_using_statement = false:none
121158

122159
# Expression-level preferences
123-
csharp_prefer_simple_default_expression = true:suggestion
124160
csharp_style_deconstructed_variable_declaration = true:suggestion
125-
csharp_style_inlined_variable_declaration = true:suggestion
126161
csharp_style_pattern_local_over_anonymous_function = true:suggestion
127162
csharp_style_prefer_index_operator = true:suggestion
128163
csharp_style_prefer_range_operator = true:suggestion
129-
csharp_style_throw_expression = true:suggestion
130164
csharp_style_unused_value_assignment_preference = discard_variable:suggestion
131165
csharp_style_unused_value_expression_statement_preference = discard_variable:silent
132166

@@ -152,36 +186,11 @@ csharp_indent_case_contents_when_block = true
152186
csharp_indent_labels = one_less_than_current
153187
csharp_indent_switch_labels = true
154188

155-
# Space preferences
156-
csharp_space_after_cast = false
157-
csharp_space_after_colon_in_inheritance_clause = true
158-
csharp_space_after_comma = true
159-
csharp_space_after_dot = false
160-
csharp_space_after_keywords_in_control_flow_statements = true
161-
csharp_space_after_semicolon_in_for_statement = true
162-
csharp_space_around_binary_operators = before_and_after
163-
csharp_space_around_declaration_statements = false
164-
csharp_space_before_colon_in_inheritance_clause = true
165-
csharp_space_before_comma = false
166-
csharp_space_before_dot = false
167-
csharp_space_before_open_square_brackets = false
168-
csharp_space_before_semicolon_in_for_statement = false
169-
csharp_space_between_empty_square_brackets = false
170-
csharp_space_between_method_call_empty_parameter_list_parentheses = false
171-
csharp_space_between_method_call_name_and_opening_parenthesis = false
172-
csharp_space_between_method_call_parameter_list_parentheses = false
173-
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
174-
csharp_space_between_method_declaration_name_and_open_parenthesis = false
175-
csharp_space_between_method_declaration_parameter_list_parentheses = false
176-
csharp_space_between_parentheses = false
177-
csharp_space_between_square_brackets = false
178-
179189
# Wrapping preferences
180190
csharp_preserve_single_line_blocks = true
181-
csharp_preserve_single_line_statements = true
191+
csharp_preserve_single_line_statements = false
182192

183193
#### Naming styles ####
184-
[*.{cs,vb}]
185194

186195
# Naming rules
187196

@@ -261,67 +270,93 @@ dotnet_naming_rule.non_field_members_should_be_pascalcase.severity = suggestion
261270
dotnet_naming_rule.non_field_members_should_be_pascalcase.symbols = non_field_members
262271
dotnet_naming_rule.non_field_members_should_be_pascalcase.style = pascalcase
263272

273+
# name all constant fields using PascalCase
274+
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
275+
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
276+
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
277+
dotnet_naming_symbols.constant_fields.applicable_kinds = field
278+
dotnet_naming_symbols.constant_fields.required_modifiers = const
279+
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
280+
281+
dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion
282+
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
283+
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
284+
dotnet_naming_symbols.static_fields.applicable_kinds = field
285+
dotnet_naming_symbols.static_fields.required_modifiers = static
286+
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
287+
dotnet_naming_style.static_prefix_style.required_prefix = s_
288+
dotnet_naming_style.static_prefix_style.capitalization = camel_case
289+
290+
# internal and private fields should be _camelCase
291+
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
292+
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
293+
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
294+
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
295+
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
296+
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
297+
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
298+
264299
# Symbol specifications
265300

266301
dotnet_naming_symbols.interfaces.applicable_kinds = interface
267302
dotnet_naming_symbols.interfaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
268-
dotnet_naming_symbols.interfaces.required_modifiers =
303+
dotnet_naming_symbols.interfaces.required_modifiers =
269304

270305
dotnet_naming_symbols.enums.applicable_kinds = enum
271306
dotnet_naming_symbols.enums.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
272-
dotnet_naming_symbols.enums.required_modifiers =
307+
dotnet_naming_symbols.enums.required_modifiers =
273308

274309
dotnet_naming_symbols.events.applicable_kinds = event
275310
dotnet_naming_symbols.events.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
276-
dotnet_naming_symbols.events.required_modifiers =
311+
dotnet_naming_symbols.events.required_modifiers =
277312

278313
dotnet_naming_symbols.methods.applicable_kinds = method
279314
dotnet_naming_symbols.methods.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
280-
dotnet_naming_symbols.methods.required_modifiers =
315+
dotnet_naming_symbols.methods.required_modifiers =
281316

282317
dotnet_naming_symbols.properties.applicable_kinds = property
283318
dotnet_naming_symbols.properties.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
284-
dotnet_naming_symbols.properties.required_modifiers =
319+
dotnet_naming_symbols.properties.required_modifiers =
285320

286321
dotnet_naming_symbols.public_fields.applicable_kinds = field
287322
dotnet_naming_symbols.public_fields.applicable_accessibilities = public, internal
288-
dotnet_naming_symbols.public_fields.required_modifiers =
323+
dotnet_naming_symbols.public_fields.required_modifiers =
289324

290325
dotnet_naming_symbols.private_fields.applicable_kinds = field
291326
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
292-
dotnet_naming_symbols.private_fields.required_modifiers =
327+
dotnet_naming_symbols.private_fields.required_modifiers =
293328

294329
dotnet_naming_symbols.private_static_fields.applicable_kinds = field
295330
dotnet_naming_symbols.private_static_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
296331
dotnet_naming_symbols.private_static_fields.required_modifiers = static
297332

298333
dotnet_naming_symbols.types_and_namespaces.applicable_kinds = namespace, class, struct, interface, enum
299334
dotnet_naming_symbols.types_and_namespaces.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
300-
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
335+
dotnet_naming_symbols.types_and_namespaces.required_modifiers =
301336

302337
dotnet_naming_symbols.non_field_members.applicable_kinds = property, event, method
303338
dotnet_naming_symbols.non_field_members.applicable_accessibilities = public, internal, private, protected, protected_internal, private_protected
304-
dotnet_naming_symbols.non_field_members.required_modifiers =
339+
dotnet_naming_symbols.non_field_members.required_modifiers =
305340

306341
dotnet_naming_symbols.type_parameters.applicable_kinds = namespace
307342
dotnet_naming_symbols.type_parameters.applicable_accessibilities = *
308-
dotnet_naming_symbols.type_parameters.required_modifiers =
343+
dotnet_naming_symbols.type_parameters.required_modifiers =
309344

310345
dotnet_naming_symbols.private_constant_fields.applicable_kinds = field
311346
dotnet_naming_symbols.private_constant_fields.applicable_accessibilities = private, protected, protected_internal, private_protected
312347
dotnet_naming_symbols.private_constant_fields.required_modifiers = const
313348

314349
dotnet_naming_symbols.local_variables.applicable_kinds = local
315350
dotnet_naming_symbols.local_variables.applicable_accessibilities = local
316-
dotnet_naming_symbols.local_variables.required_modifiers =
351+
dotnet_naming_symbols.local_variables.required_modifiers =
317352

318353
dotnet_naming_symbols.local_constants.applicable_kinds = local
319354
dotnet_naming_symbols.local_constants.applicable_accessibilities = local
320355
dotnet_naming_symbols.local_constants.required_modifiers = const
321356

322357
dotnet_naming_symbols.parameters.applicable_kinds = parameter
323358
dotnet_naming_symbols.parameters.applicable_accessibilities = *
324-
dotnet_naming_symbols.parameters.required_modifiers =
359+
dotnet_naming_symbols.parameters.required_modifiers =
325360

326361
dotnet_naming_symbols.public_constant_fields.applicable_kinds = field
327362
dotnet_naming_symbols.public_constant_fields.applicable_accessibilities = public, internal
@@ -337,36 +372,40 @@ dotnet_naming_symbols.private_static_readonly_fields.required_modifiers = readon
337372

338373
dotnet_naming_symbols.local_functions.applicable_kinds = local_function
339374
dotnet_naming_symbols.local_functions.applicable_accessibilities = *
340-
dotnet_naming_symbols.local_functions.required_modifiers =
375+
dotnet_naming_symbols.local_functions.required_modifiers =
341376

342377
# Naming styles
343378

344-
dotnet_naming_style.pascalcase.required_prefix =
345-
dotnet_naming_style.pascalcase.required_suffix =
346-
dotnet_naming_style.pascalcase.word_separator =
379+
dotnet_naming_style.pascalcase.required_prefix =
380+
dotnet_naming_style.pascalcase.required_suffix =
381+
dotnet_naming_style.pascalcase.word_separator =
347382
dotnet_naming_style.pascalcase.capitalization = pascal_case
348383

349384
dotnet_naming_style.ipascalcase.required_prefix = I
350-
dotnet_naming_style.ipascalcase.required_suffix =
351-
dotnet_naming_style.ipascalcase.word_separator =
385+
dotnet_naming_style.ipascalcase.required_suffix =
386+
dotnet_naming_style.ipascalcase.word_separator =
352387
dotnet_naming_style.ipascalcase.capitalization = pascal_case
353388

354389
dotnet_naming_style.tpascalcase.required_prefix = T
355-
dotnet_naming_style.tpascalcase.required_suffix =
356-
dotnet_naming_style.tpascalcase.word_separator =
390+
dotnet_naming_style.tpascalcase.required_suffix =
391+
dotnet_naming_style.tpascalcase.word_separator =
357392
dotnet_naming_style.tpascalcase.capitalization = pascal_case
358393

359394
dotnet_naming_style._camelcase.required_prefix = _
360-
dotnet_naming_style._camelcase.required_suffix =
361-
dotnet_naming_style._camelcase.word_separator =
395+
dotnet_naming_style._camelcase.required_suffix =
396+
dotnet_naming_style._camelcase.word_separator =
362397
dotnet_naming_style._camelcase.capitalization = camel_case
363398

364-
dotnet_naming_style.camelcase.required_prefix =
365-
dotnet_naming_style.camelcase.required_suffix =
366-
dotnet_naming_style.camelcase.word_separator =
399+
dotnet_naming_style.camelcase.required_prefix =
400+
dotnet_naming_style.camelcase.required_suffix =
401+
dotnet_naming_style.camelcase.word_separator =
367402
dotnet_naming_style.camelcase.capitalization = camel_case
368403

369404
dotnet_naming_style.s_camelcase.required_prefix = s_
370-
dotnet_naming_style.s_camelcase.required_suffix =
371-
dotnet_naming_style.s_camelcase.word_separator =
372-
dotnet_naming_style.s_camelcase.capitalization = camel_case
405+
dotnet_naming_style.s_camelcase.required_suffix =
406+
dotnet_naming_style.s_camelcase.word_separator =
407+
dotnet_naming_style.s_camelcase.capitalization = camel_case
408+
409+
# Xml config files
410+
[*.{props,targets,config,nuspec}]
411+
indent_size = 2

0 commit comments

Comments
 (0)