//\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
// CommonHelpers satellite library | Author: Sergei Y.Kitáev
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
using System;
using System.Globalization;

#if !WASM
namespace CommonHelpers {
#else
namespace CommonHelpers.WASM {
#endif

//**************************************************************************************************
public static partial class HDateTime {
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

public static bool TryParse(string src,out DateTime dst)
   { return HValueParser.TryParse(src,new object[0],out dst); }
public static bool TryParse(string src,DateTime def,out DateTime dst)
   { return HValueParser.TryParse(src,new object[0],def,out dst); }

public static bool TryParse( string src, IFormatProvider provider,
                             out DateTime dst )
   { return HValueParser.TryParse(src,new object[]{provider},out dst); }
public static bool TryParse( string src, IFormatProvider provider, DateTime def,
                             out DateTime dst )
   { return HValueParser.TryParse(src,new object[]{provider},def,out dst); }

public static bool TryParse( string src, IFormatProvider provider, DateTimeStyles styles,
                             out DateTime dst )
   { return HValueParser.TryParse(src,new object[]{provider,styles},out dst); }
public static bool TryParse( string src, IFormatProvider provider,
                             DateTimeStyles styles, DateTime def,
                             out DateTime dst )
   { return HValueParser.TryParse(src,new object[]{provider,styles},def,out dst); }

//--------------------------------------------------------------------------------------------------

public static bool TryParseInvariant(string src,out DateTime dst)
{
   return HValueParser.TryParse(src,new object[]{DateTimeFormatInfo.InvariantInfo},out dst);
}

public static bool TryParseInvariant( string src, DateTime def,
                                      out DateTime dst )
{
   return HValueParser.TryParse(src,new object[]{DateTimeFormatInfo.InvariantInfo},def,out dst);
}

//==================================================================================================

public static bool TryParseExact( string src, string format,
                                  out DateTime dst )
   { return TryParseExactEx(src,format,null,out dst); }
public static bool TryParseExact( string src, string format, DateTime def,
                                  out DateTime dst )
   { return TryParseExactEx(src,format,null,def,out dst); }

public static bool TryParseExact( string src,string format, IFormatProvider provider,
                                  out DateTime dst )
   { return TryParseExactEx(src,format,new object[]{provider},out dst); }
public static bool TryParseExact( string src,string format,
                                  IFormatProvider provider, DateTime def,
                                  out DateTime dst )
   { return TryParseExactEx(src,format,new object[]{provider},def,out dst); }

public static bool TryParseExact( string src, string format,
                                  IFormatProvider provider, DateTimeStyles styles,
                                  out DateTime dst )
{
   return TryParseExactEx(src,format,new object[]{provider,styles},out dst);
}

public static bool TryParseExact( string src, string format, IFormatProvider provider,
                                  DateTimeStyles styles, DateTime def,
                                  out DateTime dst )
{
   return
      TryParseExactEx(src,format,new object[]{provider,styles},def,out dst);
}

//--------------------------------------------------------------------------------------------------

public static bool TryParseExactInvariant( string src, string format, out DateTime dst )
{
   return
      TryParseExactEx( src, format, new object[]{DateTimeFormatInfo.InvariantInfo},
                       out dst );
}

public static bool TryParseExactInvariant( string src, string format, DateTime def,
                                           out DateTime dst )
{
   return
      TryParseExactEx( src, format, new object[]{DateTimeFormatInfo.InvariantInfo},
                       def, out dst );
}

//==================================================================================================

static bool TryParseExactEx( string src, string format, object[] additionalParams,
                             out DateTime dst )
{
   return TryParseExactEx(src,format,additionalParams,null,out dst);
}

static bool TryParseExactEx( string src, string format, object[] additionalParams,
                             DateTime? def, out DateTime dst )
{
   HParseValueException e;
   return TryParseExactEx(src,format,additionalParams,def,out dst,out e);
}

//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
} // HDateTime
//**************************************************************************************************

} // CommonHelpers (.WASM)
