Skip to content

Instantly share code, notes, and snippets.


Matt Johnson-Pint mattjohnsonpint

View GitHub Profile
mattjohnsonpint / dateonlybetween.cs
Created May 21, 2021
DateOnly Between methods
View dateonlybetween.cs
public static int DaysBetween(DateOnly startDate, DateOnly endDate)
return endDate.DayNumber - startDate.DayNumber;
public static (int Months, int Days) MonthsAndDaysBetween(DateOnly startDate, DateOnly endDate)
int months = (endDate.Year - startDate.Year) * 12 + endDate.Month - startDate.Month;
DateOnly testDate = startDate.AddMonths(months);
mattjohnsonpint / PathModelBinderAttribute.cs
Created Nov 15, 2018
Path Model Binder for ASP.NET Core
View PathModelBinderAttribute.cs
using System;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace MyNameSpace
public class PathModelBinderAttribute : ModelBinderAttribute
mattjohnsonpint / Program.cs
Created Jan 30, 2017
Just playing with clocks
View Program.cs
using System;
using System.Runtime.InteropServices;
namespace PreciseTimeTest
public class Program
public static void Main(string[] args)
mattjohnsonpint / Egypt_2016_DST_Cancellation.reg
Last active Jul 7, 2016
Windows Registry Patch for Egypt 2016 Cancellation of DST
View Egypt_2016_DST_Cancellation.reg
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time]
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Time Zones\Egypt Standard Time\Dynamic DST]
mattjohnsonpint / windowsZones-override.xml
Last active Jun 15, 2016
CLDR Overrides for June 2016
View windowsZones-override.xml
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE supplementalData SYSTEM "../../common/dtd/ldmlSupplemental.dtd">
Copyright © 1991-2013 Unicode, Inc.
CLDR data files are interpreted according to the LDML specification (
For terms of use, see
<version number="$Revision$"/>
mattjohnsonpint / railstz.json
Created May 11, 2016
Rails TZ Map in JSON
View railstz.json
"International Date Line West":"Pacific/Midway",
"Midway Island":"Pacific/Midway",
"American Samoa":"Pacific/Pago_Pago",
"Pacific Time (US & Canada)":"America/Los_Angeles",
"Mountain Time (US & Canada)":"America/Denver",
mattjohnsonpint / Program.cs
Created Feb 9, 2016
Testing ISO8601 formatting performance
View Program.cs
using System;
using System.Diagnostics;
using System.Globalization;
namespace DateTimeToIsoStringPerfTests
class Program
static void Main(string[] args)

moment 2.11.1 changelog


  • #2881 Revert "Merge pull request #2746 from mbad0la:develop" Sep->Sept
  • #2868 Add format and parse token Y, so it actually works
  • #2865 Use typeof checks for undefined for global variables
  • #2858 Fix Date mocking regression introduced in 2.11.0
  • #2864 Include changelog in npm release
  • #2830 dep: add grunt-cli
  • #2869 Fix months parsing for some locales
mattjohnsonpint / Program.cs
Created Nov 7, 2015
Demonstration for StackOverflow question 33579361
View Program.cs
using System;
using System.Globalization;
using NodaTime;
using NodaTime.Text;
namespace ConsoleApplication10
class Program
static void Main(string[] args)
mattjohnsonpint / wordpresstz.html
Created Oct 12, 2015
Wordpress Timezone List
View wordpresstz.html
<select id="timezone_string" name="timezone_string" aria-describedby="timezone-description">
<optgroup label="Africa">
<option value="Africa/Abidjan">Abidjan</option>
<option value="Africa/Accra">Accra</option>
<option value="Africa/Addis_Ababa">Addis Ababa</option>
<option value="Africa/Algiers">Algiers</option>
<option value="Africa/Asmara">Asmara</option>
<option value="Africa/Bamako">Bamako</option>
<option value="Africa/Bangui">Bangui</option>
<option value="Africa/Banjul">Banjul</option>