jskeet on master
Update CONTRIBUTING.md (compare)
jskeet on master
Fix typo in commandline readme Note the use of bash for scripts (compare)
jskeet on master
Point at global.json to indicat… (compare)
doda time
gets you Doda's Time
var endLocalDate = now.InZone(tz).Date;
var startLocalDate = LocalDate.Add(endLocalDate, Period.FromDays(1));
var end = endLocalDate.AtMidnight().InUtc();
var start = startLocalDate.AtMidnight().InUtc();
string tz = TZConvert.WindowsToIana("Eastern Standard Time");
// result: "America/New_York"
How can we get this in javascript
Instant
makes so much sense, really happy I found NT!
Some extra musings about TZDB-related things: Generally, you're going to want to control those updates just like any other dependency. The kicker is that:
1) Updates happen way more often (a stable NodaTime base package theoretically never updates)
2) You usually want to update the database more quickly than code
3) Depending on what other systems your code interacts with, you will also need to make sure your OS or RDBMS is updated to the same version of the TZDB. Serialized data using a zoned date-time (usually, future calendar appointments) needs to be updated appropriately.
I'm in Chicago and still have no idea how to get current GMT time In Australia for example.
Well, the first thing would be that there's no such thing as "GMT time in Australia".
You can get an offset from GMT/UTC at a specific instant (or some "local" times). Which is best accomplished by getting the time zone you want first, anyways:
// Olson TZDB zones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
DateTimeZone zone = DateTimeZoneProviders.Tzdb["Australia/Sydney"];
Offset offset = zone.GetUtcOffset(someInjectedClock.GetCurrentInstant());
.... the fact that you might be in Chicago is irrelevant.
someInjectedClock
part, for the production dependency, you'd normally use SystemClock.Instance
. Noda Time treats both time zone provision and "what's the current instant?" as services that should be injected to make testing much easier. There's a separate NodaTime.Testing
package that contains a FakeClock
and a (less commonly used) FakeDateTimeZoneSource
so that you can inject both IClock
and IDateTimeZoneProvider
- then your unit tests can be completely deterministic, regardless of system time or any changes to DateTimeZoneProviders.Tzdb
over the course of different Noda Time releases.
AtLeniently
produced an unexpected result on Friday. I am not familiar with the kind of edge cases that AtLeniently
makes assumptions about, would anyone have the time to look over a MWE? https://dotnetfiddle.net/0jFTax
America/New_York
and Europe/London
, even on tzdb2014e
Instant
(even if the buckets are based off of home office local time), and the time in any individual location is irrelevant.
DateTime
, Date
, AnnualDate
etc, all stored with EF Core.Instant
, although for historical/legal reasons it's stated as some sort of ZonedDateTime
(with resolution in minutes).LocalDateTime
values and AnnualDate
values? LocalDateTime
naturally sorts by year first. From the database side, your best bet is likely a set of nullable columns (setting less precise ones if a more precise one is specified), plus a set of separated, derived columns to perform searching/sorting on.