Skip to content

Commit ce39aec

Browse files
committed
v1.0.0
1 parent f06766c commit ce39aec

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

UtcConverter.bas

+11-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Attribute VB_Name = "UtcConverter"
22
''
3-
' VBA-UTC v1.0.0-rc.4
3+
' VBA-UTC v1.0.0
44
' (c) Tim Hall - https://github.com/VBA-tools/VBA-UtcConverter
55
'
66
' UTC/ISO 8601 Converter for VBA
@@ -14,7 +14,7 @@ Attribute VB_Name = "UtcConverter"
1414
' @module UtcConverter
1515
1616
' @license MIT (http://www.opensource.org/licenses/mit-license.php)
17-
' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
17+
'' ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ '
1818

1919
#If Mac Then
2020

@@ -86,6 +86,7 @@ End Type
8686
' @method ParseUtc
8787
' @param {Date} UtcDate
8888
' @return {Date} Local date
89+
' @throws 10011 - UTC parsing error
8990
''
9091
Public Function ParseUtc(utc_UtcDate As Date) As Date
9192
On Error GoTo utc_ErrorHandling
@@ -114,6 +115,7 @@ End Function
114115
' @method ConvertToUrc
115116
' @param {Date} utc_LocalDate
116117
' @return {Date} UTC date
118+
' @throws 10012 - UTC conversion error
117119
''
118120
Public Function ConvertToUtc(utc_LocalDate As Date) As Date
119121
On Error GoTo utc_ErrorHandling
@@ -142,6 +144,7 @@ End Function
142144
' @method ParseIso
143145
' @param {Date} utc_IsoString
144146
' @return {Date} Local date
147+
' @throws 10013 - ISO 8601 parsing error
145148
''
146149
Public Function ParseIso(utc_IsoString As String) As Date
147150
On Error GoTo utc_ErrorHandling
@@ -217,6 +220,7 @@ End Function
217220
' @method ConvertToIso
218221
' @param {Date} utc_LocalDate
219222
' @return {Date} ISO 8601 string
223+
' @throws 10014 - ISO 8601 conversion error
220224
''
221225
Public Function ConvertToIso(utc_LocalDate As Date) As String
222226
On Error GoTo utc_ErrorHandling
@@ -234,6 +238,7 @@ End Function
234238
' ============================================= '
235239

236240
#If Mac Then
241+
237242
Private Function utc_ConvertDate(utc_Value As Date, Optional utc_ConvertToUtc As Boolean = False) As Date
238243
Dim utc_ShellCommand As String
239244
Dim utc_Result As utc_ShellResult
@@ -264,6 +269,7 @@ Private Function utc_ConvertDate(utc_Value As Date, Optional utc_ConvertToUtc As
264269
TimeSerial(utc_TimeParts(0), utc_TimeParts(1), utc_TimeParts(2))
265270
End If
266271
End Function
272+
267273
Private Function utc_ExecuteInShell(utc_ShellCommand As String) As utc_ShellResult
268274
Dim utc_File As Long
269275
Dim utc_Chunk As String
@@ -286,7 +292,9 @@ Private Function utc_ExecuteInShell(utc_ShellCommand As String) As utc_ShellResu
286292
utc_ErrorHandling:
287293
utc_ExecuteInShell.utc_ExitCode = utc_pclose(utc_File)
288294
End Function
295+
289296
#Else
297+
290298
Private Function utc_DateToSystemTime(utc_Value As Date) As utc_SYSTEMTIME
291299
utc_DateToSystemTime.utc_wYear = VBA.Year(utc_Value)
292300
utc_DateToSystemTime.utc_wMonth = VBA.Month(utc_Value)
@@ -301,4 +309,5 @@ Private Function utc_SystemTimeToDate(utc_Value As utc_SYSTEMTIME) As Date
301309
utc_SystemTimeToDate = DateSerial(utc_Value.utc_wYear, utc_Value.utc_wMonth, utc_Value.utc_wDay) + _
302310
TimeSerial(utc_Value.utc_wHour, utc_Value.utc_wMinute, utc_Value.utc_wSecond)
303311
End Function
312+
304313
#End If

specs/VBA-UTC - Specs.xlsm

4.49 KB
Binary file not shown.

0 commit comments

Comments
 (0)