History homework helper Doing my history reading and note-taking, I can't help but get tired of writing out all these long dates –– 1784 is six entire pencil lifts! jǝǝz!

As you can see, I –– like most challenge posters on this site –– am lazy when it comes to writing stuff. Thus, I ask you to please help me shorten some dates. Of course, your solution must be as short as possible since my hand is already tired from writing typing out the test cases.

How do I shorten a date?

Well funny you should ask. It's fairly simple:


Take two integers as input in whatever order you want ((smallest, biggest) or (biggest, smallest)).
Take the larger of the two numbers, and take only the part not in the smaller number. 
 For example, given 2010, 2017, shorten 2017 to -7 because 201_ is in both at the same digit-places. 
Print or return the smaller number, followed by a dash and then the shortened larger number.


For example:

Bonus brownies for you if you figure out these dates' significance :)
1505, 1516 -&gt; 1505-16
1989, 1991 -&gt; 1989-91
1914, 1918 -&gt; 1914-8
1833, 1871 -&gt; 1833-71
1000, 2000 -&gt; 1000-2000
1776, 2017 -&gt; 1776-2017
2016, 2016 -&gt; 2016-

These dates lack significance :(
1234567890, 1234567891 -&gt; 1234567890-1
600, 1600 -&gt; 600-1600
1235, 1424 -&gt; 1235-424
600, 6000 -&gt; 600-6000
Jelly, &nbsp;17&nbsp;  16 bytes

DUµn/TṪṁ@Ṫ,j”-FṚ


A full program taking a list of years from, to and printing the result.

Try it online! or see the test suite.

How?

DUµn/TṪṁ@Ṫ,j”-FṚ - Main link: list of years [from, to]    e.g [1833,1871]
D                - convert to decimals                        [[1,8,3,3],[1,8,7,1]]
 U               - upend (to cater for differing lengths)     [[3,3,8,1],[1,7,8,1]]
  µ              - monadic chain separation, call that V
    /            - reduce V with:
   n             -   not equal?                               [1,1,0,0]
     T           - truthy indices                             [1, 2]
      Ṫ          - tail                                       2
         Ṫ       - tail V (pop from &amp; modify V)               [1,7,8,1]
       ṁ@        - mould (swap @rguments) V like that length  [1,7]
          ,      - pair that with (the modified) V            [[1,7],[[3,3,8,1]]
            ”-   - literal '-' character
           j     - join                                       [1,7,'-',[3,3,8,1]]
              F  - flatten                                    [1,7,'-',3,3,8,1]
               Ṛ - reverse                                    [1,8,3,3,'-',7,1]
                 - implicit print                             1833-71