Timeline for Return Nth Weekday of Month
Current License: CC BY-SA 3.0
19 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 12, 2015 at 4:57 | review | Suggested edits | |||
Aug 12, 2015 at 8:35 | |||||
Aug 11, 2015 at 22:10 | history | edited | Jeroen Vannevel |
edited tags
|
|
Aug 11, 2015 at 21:53 | answer | added | jakubka | timeline score: 7 | |
Aug 11, 2015 at 21:24 | history | tweeted | twitter.com/#!/StackCodeReview/status/631214699955290112 | ||
Aug 11, 2015 at 19:30 | comment | added | Jesse C. Slicer |
@Mat'sMug just a clarification - I believe the return at the bottom of the method is for expected values and should be null . The first return being used in the guard clause is the perfect place for an exception.
|
|
Aug 11, 2015 at 18:06 | answer | added | user80985 | timeline score: 0 | |
Aug 11, 2015 at 17:46 | comment | added | Rick Davin |
The OP also uses the input date's Year when declaring currentDay . So not just the month is used. I would go as far as to include date's Kind just because.
|
|
Aug 11, 2015 at 17:38 | comment | added | Jesse C. Slicer | @Mat'sMug if you ask me, that's not an exceptional condition, but an expected boundary that can be hit given valid inputs. | |
Aug 11, 2015 at 17:37 | comment | added | Mathieu Guindon | @JesseC.Slicer how about throwing instead? | |
Aug 11, 2015 at 17:37 | answer | added | Mathieu Guindon | timeline score: 7 | |
Aug 11, 2015 at 17:36 | comment | added | temarsden | @JesseC.Slicer Excellent suggestion, thank you. | |
Aug 11, 2015 at 17:29 | answer | added | Dan Lyons | timeline score: 4 | |
Aug 11, 2015 at 17:25 | comment | added | Jesse C. Slicer |
My only suggestion - not worthy of an answer, would be to change the return type to DateTime? and return null instead of DateTime.MinValue in the case next weekday does not exist. It seem more pragmatic to me than using the "magic" of MinValue .
|
|
Aug 11, 2015 at 17:21 | vote | accept | temarsden | ||
Aug 11, 2015 at 17:05 | answer | added | Malachi | timeline score: 8 | |
Aug 11, 2015 at 17:04 | history | edited | temarsden | CC BY-SA 3.0 |
edited body
|
Aug 11, 2015 at 16:54 | history | edited | Malachi | CC BY-SA 3.0 |
removed tag from title. please show appreciation by upvoting the good answers and accepting the best answer
|
Aug 11, 2015 at 16:53 | review | First posts | |||
Aug 11, 2015 at 16:57 | |||||
Aug 11, 2015 at 16:48 | history | asked | temarsden | CC BY-SA 3.0 |